Guest User

Untitled

a guest
Nov 8th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <?php
  2. require_once("connection.php");
  3. if(isset($_GET['submit']))
  4. {
  5. $id=$_GET['id'];
  6. $f_name=$_GET['f_name'];
  7. $email=$_GET['email'];
  8. $contact=$_GET['contact'];
  9.  
  10. $sql="insert into form values ('$id', '$f_name', '$email', '$contact')";
  11. mysqli_query($conn,$sql);
  12. }
  13. ?>
  14.  
  15.  
  16. <html>
  17. <body>
  18.  
  19. <form action="index.php" method="get">
  20.  
  21. </br>
  22. <label> id</label>
  23. <input type="number" name="id">
  24. </br>
  25. <label> First Name</label>
  26. <input type="text" name="f_name">
  27. </br>
  28. <label> Email</label>
  29. </br>
  30. <input type="email" name="email">
  31. </br><label>contact</label>
  32. </br>
  33. <input type="number" name="contact">
  34. </br>
  35.  
  36. <input type="submit" name="submit">
  37. </form>
  38.  
  39. </body>
  40. </html>
  41.  
  42.  
  43.  
  44.  
  45.  
  46. <?php
  47. /**
  48. * Created by PhpStorm.
  49. * User: admin
  50. * Date: 11/8/2018
  51. * Time: 1:13 PM
  52. */
  53. $servername="localhost";
  54. $username="root";
  55. $password="";
  56. $db="form";
  57.  
  58. $conn=new mysqli($servername,$username,$password,$db);
  59. if ($conn->connect_error) {
  60. die("Connection failed: " . $conn->connect_error);
  61. }
  62. echo "Connected successfully";
  63. ?>
Add Comment
Please, Sign In to add comment