Advertisement
Guest User

Untitled

a guest
Oct 30th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1.  
  2. <?php
  3. $servername = "localhost";
  4. $username = "";
  5. $password = "";
  6.  
  7. $con = mysqli_connect('localhost', '','');
  8.  
  9. if(!$con)
  10. {
  11. echo 'Not Connected To Server';
  12. }
  13. if (!mysqli_select_db ($con,'zkhalid1_iltcis_16oct'))
  14. {
  15. echo 'Database Not Selected';
  16. }
  17.  
  18. $Name = $_POST['name'];
  19. $Email = $_POST['email'];
  20. $Gender= $_POST['gender'];
  21. $Age= $_POST['age'];
  22.  
  23.  
  24. $sql = "insert into People (Name,Email,Gender,Age) values ('$Name','$Email','$Gender','$Age')";
  25.  
  26. if (!mysqli_query($con,$sql))
  27. {
  28. echo 'Not Inserted';
  29. }
  30.  
  31. else
  32. {
  33. echo 'Connection Successful';
  34. }
  35.  
  36. ?>
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. <fieldset><legend> Please enter Your Information Below </legend>
  45. <form action="insert.php" method="post">
  46. <p>Name: <input type="text" name="name"/> </p>
  47. </br>
  48. <p>Email: <input type="text" name="email"/></p>
  49. </br>
  50. <p>Age: <input type="text" name="age"/></p>
  51. </br>
  52. <p>Gender: <input type="radio" name="gender" value="M"/> Male
  53. <input type="radio" name="gender" value="F"/> Female</p>
  54. <input type="submit" value="Submit">
  55. </form>
  56. </fieldset>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement