Advertisement
Guest User

Untitled

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