<!DOCTYPE html> <html> <body> <form action="abc.php" method="post"> Full Name: <input type="text" name="Name" /> E-mail: <input type="text" name="email" /> Phone: <input type="tel" name="phone" /> <input type="submit"/> </form> </body> </html>
After submitting the form, the data will be transferred to abc.php and the data in the file abc.php can be accessed like below:
<!DOCTYPE html> <html> <body> Hello Welcome <?php echo $_POST["Name"]; ?>, Email ID is: <?php echo $_POST["email"]; ?> And phone Number is : <?php echo $_POST["phone"]; ?> </body> </html>
When clicked on Submit in the above output, the below output appears showing the details.
$_POST['anyage']are sent automatically by PHP.
Previously $_SERVER superglobal was used.Here superglobal $_POST is introduced that has entire POST data.Here,from method is POST. If GET method is used, then the information of form would have been stored in $_GET superglobal instead.
Superglobal $_REQUEST can also be used, if source of request data is not taken into consideration. It possess the merged data of GET, POST and COOKIE.