PHP - examples form handling

Revision:


a simple HTML form

One of the most powerful features of PHP is the way it handles HTML forms. Once the user enters data and submits a form, the PHP superglobals $_GET and $_POST variables are used to collect that form-data.

example: "post"

name:
email:
codes:
        <form action="trial-post.php" method="post">
            <span>name:</span> <input type="text" name="name"/><br>
            <span>email:</span> <input type="text" name="email"/>
            <input type="submit"/>
        </form>
        <!-- When the user fills out the form above and clicks the submit button,  
        the form data is sent for processing to a PHP file named "trial.php". 
        The form data is sent with the HTTP POST method. -->
    

example: "get"

name:
email:
codes:
        <form action="trial-get.php" method="get">
            <span>name:</span> <input type="text" name="name"/><br>
            <span>email:</span> <input type="text" name="email"/>
            <input type="submit"/>
        </form>
        <!-- When the user fills out the form above and clicks the submit button,  
        the form data is sent for processing to a PHP file named "welcome-get.php". 
        The form data is sent with the HTTP GET method. -->
    

form handling with PHP

example:

name:

password:

gender Male: Female:

Residential Status:

About me:

Email:

Web Link: