Guest User

Untitled

a guest
Sep 3rd, 2017
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title> Student_data
  4. </title>
  5. </head>
  6. <body>
  7. <center>
  8.  
  9.  
  10.  
  11. <form action=studentdbase.php" methord="post"><br><br>
  12.  
  13. Enter your first name:
  14. <input type="text" name="firstname" value="" ><br>
  15. Enter your last name:
  16. <input type="text" name="lastname" value="" ><br>
  17.  
  18. Enter your phone no.:
  19. <input type="number" name="phno" value="" ><br>
  20. Enter your class:
  21. <input type="number" name="class" value="" ><br>
  22. Enter your Roll no.:
  23. <input type="number" name="rollno" value="" ><br><br><br>
  24. <input type ="submit" value=" Submit " name="submit">
  25. </form>
  26.  
  27.  
  28. <?php
  29.  
  30. $dbhost = "localhost";
  31. $dbuser = "root";
  32. $dbpass="";
  33. $db = "student";
  34.  
  35. $conn = new mysql ($dbhost,$dbuser,$dbpass,$db);
  36.  
  37.  
  38. if($conn->connect_error){
  39. echo "Connection was failed";
  40. }
  41. $f_name=$_POST['firstname'];
  42. $l_name=$_POST['lastname'];
  43. $p_no=$_POST['phno'];
  44. $class=$_POST['class'];
  45. $roll=$_POST['rollno'];
  46.  
  47. if (!$_POST['submit'])
  48. { echo "Lazy";
  49. }
  50. else {
  51. $sql = "INSERT into studentdbase (firstname,lastname,phno,class,rollno)
  52. values ('$f_name','$l_name','$p_no','$class','$roll')";
  53. if (mysql_query($conn, $sql))
  54. { echo "data creation complete" }
  55. else{
  56. echo "something went wrong" }
  57. }
  58. ?>
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68. </body>
  69. </html>
Add Comment
Please, Sign In to add comment