Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. <?php
- 2.
- 3. $hostname = "localhost"; //MySQL hostname
- 4. $username = "root"; //MySQL username
- 5. $password=""; //MySQL password
- 6. $databasename="student_s2"; //MySQL database name
- 7.
- 8. //connect to the database
- 9. $db=new mysqli($hostname,$username,$password, $databasename);
- 10. /* If connection was not
- 11. successful, handle the error*/
- 12.
- 13. if($db->connect_errno > 0){
- 14. die('Unable to connect to database '.$db->connect_error);
- 15. }
- 16. //echo 'Connected successfully';
- 17. ?>
- 18.
- 19. ----------------------------------------------------------------
- 20. <html><body> <!--db2_form.php -->
- 21. <form action="db3_add.php" method="post">
- 22.
- 23. <table border=1>
- 24. <tr>
- 25. <th colspan="2">Student Registration</th>
- 26. </tr>
- 27.
- 28. <tr>
- 29. <td >Student ID</td>
- 30. <td><input name="studentid" type="text" required/></td>
- 31. </tr>
- 32.
- 33. <tr>
- 34. <td>Name</td>
- 35. <td>
- 36. <input name="studentname" type="text" /></td>
- 37. </tr>
- 38.
- 39. <tr>
- 40. <td>Department</td>
- 41. <td>
- 42. <select name="department">
- 43. <option value="IT">IT</option>
- 44. <o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement