Read Time:52 Second

The PHP superglobals $_GET and $_POST are used to collect form-data.
Step 1- Create a simple HTML form
index.html
<html> <body> <form action="welcome.php" method="post"> Name: <input type="text" name="name"><br> E-mail: <input type="text" name="email"><br> <input type="submit"> </form> </body> </html>
Step 2- Create a welcome.php file
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.php”. The form data is sent with the HTTP POST method.
To display the submitted data using form you could simply echo all the variables. The “welcome.php” looks like this:
<html> <body> Welcome <?php echo $_POST["name"]; ?><br> Your email address is: <?php echo $_POST["email"]; ?> </body> </html>
Output:
Welcome Ram
Your email address is ram.kumar@example.com
Notes: Developers prefer POST for sending form data.