Form Form is an excellent way to allow users to interact with your web application and submit data across the web pages. In the example below, the user fills out his/her name and age in the text boxes. When the Submit button is clicked, these data will be sent from the Form page to the Welcome page.
<form action="welcome.php" method="post">
Please enter your name and age
<table style="color:black; background:green">
<td>Name:</td><td> <input type="text" name="fname" /> </td>
<td>Age: </td><td><input type="text" name="age" /> </td>
<input type="submit" />
When a user fill out the form and click submit, the data will be sent to welcome.php file:
Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.
Note: $_POST is used to get information submitted by post method. Post method will hide information in address bar and it does not limit the length of information that is attached to the address. $_GET is used to get information submitted by get method. Get method will display information attached with the address in address bar. It limits to the short length of information (100 characters). Alternatively, you can use $_REQUEST to get information from users.