Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2.  
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "";
  6. $dbname = "booking";
  7.  
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. if($conn->connect_error){die("Connection failed: ". $conn->connect_error);}
  10.  
  11.  
  12. $cnic = $name = $fname = $address = "";
  13.  
  14. if($_SERVER["REQUEST_METHOD"] == "POST"){
  15. $name = $_POST["name"];
  16. $cnic = $_POST["cnic"];
  17. $fname = $_POST["fname"];
  18. $address = $_POST["address"];
  19.  
  20. $sql = "INSERT INTO data (CNIC, Name, FatherName, PostalAddress) VALUES ($cnic, $name, $fname, $address)";}
  21.  
  22. ?>
  23.  
  24.  
  25. <html><body>
  26.  
  27.  
  28. <form name="f1" method="post" action="<?php echo htmlspecialchars($_SERVER
  29.  
  30. ["PHP_SELF"]);?>">
  31.  
  32. CNIC: <input type="text" name="cnic"><br>
  33. Name: <input type="text" name="name"><br>
  34. Father Name: <input type="text" name="fname"><br>
  35. Postal Address: <input type="text" name="address"><br>
  36. <input type="submit">
  37. </form>
  38.  
  39.  
  40. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement