Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "booking";
- $conn = new mysqli($servername, $username, $password, $dbname);
- if($conn->connect_error){die("Connection failed: ". $conn->connect_error);}
- $cnic = $name = $fname = $address = "";
- if($_SERVER["REQUEST_METHOD"] == "POST"){
- $name = $_POST["name"];
- $cnic = $_POST["cnic"];
- $fname = $_POST["fname"];
- $address = $_POST["address"];
- $sql = "INSERT INTO data (CNIC, Name, FatherName, PostalAddress) VALUES ($cnic, $name, $fname, $address)";}
- ?>
- <html><body>
- <form name="f1" method="post" action="<?php echo htmlspecialchars($_SERVER
- ["PHP_SELF"]);?>">
- CNIC: <input type="text" name="cnic"><br>
- Name: <input type="text" name="name"><br>
- Father Name: <input type="text" name="fname"><br>
- Postal Address: <input type="text" name="address"><br>
- <input type="submit">
- </form>
- </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement