Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- </head>
- <body>
- <!-- This creates the form. Pay attention to the "Name" of the textbox -->
- <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
- Surname <input type="text" name="Surname"><p></p>
- <input type="submit" name="submit" value="Save">
- </form>
- <?php
- $server = "localhost";
- $username = "";
- $password = "";
- $db = "";
- $conn = mysqli_connect ($server, $username, $password, $db);
- // if submit button is pushed, then take the form value (Surname) and run the insert query with it
- if (isset($_POST["submit"])) {
- $Surname = $_POST["Surname"];
- $query = mysqli_query($conn, "INSERT INTO ### Your table #### (Surname) VALUES ('$Surname')") or die(mysqli_error($conn));
- $result = mysqli_query($conn,$query);
- }
- mysqli_close($conn)
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement