Advertisement
Guest User

Untitled

a guest
Mar 16th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. <?php
  2.  
  3. //this is for database connection!
  4.  
  5. //name of your host
  6. $host = "localhost";
  7. //username of your database
  8. $username = "root";
  9. //password of your database default is blank
  10. $password = "";
  11. //name of your database
  12. $dbname = "myheroacademia";
  13.  
  14. $con = mysqli_connect("$host","$username","$password","$dbname");
  15.  
  16. if(mysqli_connect_error()){
  17. echo "Connection error";
  18.  
  19. }else{
  20.  
  21. }
  22.  
  23. ?>
  24.  
  25. <?php
  26. if(isset($_GET['submit']))
  27. {
  28. $StudentID = $_GET["num1"];
  29. $FirstName = $_GET["num2"];
  30. $LastName = $_GET["num3"];
  31. $Course = $_GET["num4"];
  32. $Birthdate = $_GET["num5"];
  33. $General = $_GET["num6"];
  34.  
  35. $sql=mysqli_query($con,"INSERT INTO table(StudentID,FirstName,LastName,Course,Birthdate,Gender) VALUES ('$StudentID','$Firstname','$Lastname','$Course','$Birthdate','$Gender')");
  36.  
  37. }
  38. ?>
  39.  
  40. <img src="myhero.jpeg" WIDTH=1022, HEIGHT=188 border"3" >
  41.  
  42. <html>
  43. <head>
  44. <title>Student Information</title>
  45. </head>
  46. <body>
  47.  
  48. <h1 align=center>STUDENT INFORMATION</h1>
  49.  
  50. <form align=center method="GET">
  51. <div>StudentID:</div>
  52. <input type="text" name="num1"/>
  53. <div>FirstName:</div>
  54. <input type="text" name="num2"/>
  55. <div>LastName:</div>
  56. <input type="text" name="num3"/>
  57. <div>Course:</div>
  58. <input type=:"text" name="num4"/>
  59. <div>Birthdate:</div>
  60. <input type="text" name="num5"/>
  61. <div>Gender:</div>
  62. <input type="text" name="num6"/>
  63. <p> </p>
  64. <button name="submit">SUBMIT TO U.A.</button>
  65. </form>
  66. <?php
  67.  
  68.  
  69. ?>
  70.  
  71. </body>
  72. </head>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement