Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <h2>HTML Forms</h2>
- <form method="POST" action="insert.php">
- First name:<br>
- <input type="text" name="firstname">
- <br>
- Last name:<br>
- <input type="text" name="lastname">
- <br><br>
- <input type="submit" value="Submit">
- </form>
- </body>
- </html>
- =======================
- insert.php
- <?php
- $fname=$_POST['firstname'];
- $lname=$_POST['lastname'];
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "fyp";
- $con = new mysqli($servername, $username, $password, $dbname);
- $query=INSERT INTO Customers (firstName, lastName)
- VALUES ('$fname','$lname');
- $result = mysqli_query($con,$query);
- ?>
Add Comment
Please, Sign In to add comment