The PHP $_GET and $_POST variables are used to retrieve information from HTML forms. Let's see an example:
Example Form Code
<form action="forms.php" method="post">
Name: <input type="text" name="name" /><br>
Age: <input type="text" name="age" />
<input type="submit" />
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:
Welcome <?php echo $_POST["name"]; ?>.<br />
Your age is <?php echo $_POST["age"]; ?> years.
Next: What is MySQL?