REQUEST_METHOD: POST
There are two ways to send the web input to the server-side scripts:
- POST method, which sends the web data to the server “behind the scenes” by putting it on the standard input, and
- GET method, by which the information that is entered into the form will be tacked on to the end of the target URL.
For an example of the POST method, consider the following form:
The input type names are
act
: the four buttons, except the Reset, which is the default for HTML,
email
: the Email input field, and
password
: the Password input field.
The standard input may contain the following string after users enter the requested information and submit:
act=Submit&email=userid@cs.und.edu&password=CSci457
In PHP, the predefined $_POST
variable is used to collect input values such as
echo "$_POST[act]";
// Print “Submit.”
echo "$_POST[email]";
// Print “userid@cs.und.edu.”
echo "$_POST[password]";
// Print “CSci457.”