![]() |
|
PHP HTML Forms Handling. Free online PHP and MySQL Web Database Programming Tutorial... |
| Lessons | PHP Forms |
|
|
The PHP $_GET and $_POST variables are used to retrieve information from HTML forms. Let's see an example: Example Form Code <html> <body> <form action="forms.php" method="post"> Name: <input type="text" name="name" /><br> Age: <input type="text" name="age" /> <input type="submit" /> </form> </body> </html> Example Form Output The example HTML page above contains two input fields; Name and Age. When a user fills in this form and clicks on the submit button, the form data is sent to the "forms.php" file. In forms.php file we can retrieve those values and use them as we need. The code of the forms.php file follows: <html> <body> Welcome <?php echo $_POST["name"]; ?>.<br /> Your age is <?php echo $_POST["age"]; ?> years. </body> </html>
Next: What is MySQL?
|