PHP – Form Introduction

By | October 2, 2021
PHP Form Introduction

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

      <title>PHP First Form</title>
         // 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">
               <td><input type = "text" name = "name"></td>
               <td><input type = "text" name = "email"></td>
                  <input type = "submit" name = "submit" value = "Submit"> 
         echo "<h2>Your details are:</h2>";
         echo $name;
         echo "<br>";         
         echo $email;
        echo "<br>";


Classes Registration

People are also reading:

Leave a Reply

Your email address will not be published. Required fields are marked *