You can store, update, or even delete data from the database with the help of dynamic website forms. These forms are provided with some fields which can be filled by the user to perform the action required. You can directly play with the data of the database.
Example of creating the form
<html> <head> <title>PHP First Form</title> </head> <body> <?php // defining variables and seting them to empty values $name = $email = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { $name = test_input($_POST["name"]); $email = test_input($_POST["email"]); } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> <h2>Classes Registration</h2> <form method = "post" action = "/php/php_form_introduction.htm"> <table> <tr> <td>Name:</td> <td><input type = "text" name = "name"></td> </tr> <tr> <td>E-mail:</td> <td><input type = "text" name = "email"></td> </tr> <tr> <td> <input type = "submit" name = "submit" value = "Submit"> </td> </tr> </table> </form> <?php echo "<h2>Your details are:</h2>"; echo $name; echo "<br>"; echo $email; echo "<br>"; ?> </body> </html>
Output
People are also reading: