This section contains the detail about POST method in PHP.
The $_POST Method in PHP
The $_POST function in PHP is used to gather data of form submit with method="post". When you send data using POST method, it is invisible to others and will not visible in browser. It has not limit of how much data you can send but by default it is set for 8 MB data transfer. You can change it by setting 'post_max_size' in the 'php.ini' file.
Given below example of how can you use it in a form :
<form action="registration.php" method="post"> Name: <input type="text" name="name" /> Address: <input type="text" name="address" /> <input type="submit" /> </form>
Fetching form data sent via POST method
You can fetch data of form as given below :
Name :<?php echo $_POST["name"]; ?><br /> Address : <?php echo $_POST["address"]; ?>
It will display the name and address which you have submitted in from.
$_REQUEST Method of PHP
The contents of both $_GET, $_POST, and $_COOKIE are contained by the PHP built-in $_REQUEST function. $_REQUEST Method is used to collect form data sent with both the GET and POST as follows :
Name : <?php echo $_REQUEST["name"]; ?><br /> Address :<?php echo $_REQUEST["address"]; ?>
[ 0 ] Comments