www.pickatutorial.com Computer Tutorials
Top eBooks: C/C++ | C# | Android | Mathematics | Database | Cloud | Graphics | Networking | Oracle | Hardware | AI
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons PHP $_POST Variable Bookmark and Share
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 14
Lesson 15
Lesson 16
Lesson 17
Lesson 18
Lesson 19
Lesson 20
Lesson 21
Lesson 22
Lesson 23
Lesson 24
Lesson 25
Lesson 26
Lesson 27
Lesson 28
Lesson 29
Lesson 30
Lesson 31
Lesson 32
Lesson 33
Lesson 34
Lesson 35
Lesson 36
Lesson 37
Lesson 38
Lesson 39
Lesson 40
Lesson 41
Lesson 42
Lesson 43
Lesson 44
The $_POST variable in php is used to collect values on the server side from a form that was submitted using the method="post".

In other words the $_POST variable is an array of variable names and values sent by the HTTP POST method. Please remember that, unlike a HTTP GET method, the information sent from a form with the POST method is not visible to anyone and it also does not have any limits on the amount of information to send.

<form action="phpPOST.php" method="post">
Name: <input type="text" name="name" /><br>
Occupation: <input type="text" name="occ" /><br>
<input type="submit" />



When you click the "Submit" button, the internet browser would take you to a URL looking something like:


Please note that, unlike, the HTTP GET method, the URL does not contain any form data.

The "phpPOST.php" file can now use the $_POST variable to catch the form data as shown below (notice that the names of the form fields will automatically be the ID keys in the $_POST array):

$name = $_POST["name"];
$occupation = $_POST["occ"];

The $_REQUEST Variable
One more PHP built in server-side variable, worth mentioning here, is the PHP $_REQUEST variable. This variable contains the contents of both $_GET and $_POST variables. Furthermore, this variable also contains the contents of the $_COOKIE variable. The PHP $_REQUEST variable can be used to get the result from form data sent with either the GET or the POST method. This is very helpful when we do not exactly know the method that is used to submit the form data. The usage of the $_REQUEST variable is very simple:

$name = $_REQUEST["name"];
$occupation = $_REQUEST["occ"];

Next: PHP Forms

Home - Advertise - Contact - Disclaimer - About Us
© Since 2006 pickatutorial.com -- All Rights Reserved.