REQUEST_METHOD: GET
By using the GET method, the input values from the form are sent as part of the URL, and saved in the QUERY_STRING
environment variable.
For an example of the GET method, consider the following form:
In PHP, the predefined $_GET
variable is used to collect input values such as
echo "$_GET[act]";
// Print “Submit.”
echo "$_GET[email]";
// Print “userid@cs.und.edu.”
echo "$_GET[password]";
// Print “CSci457.”
The GET method is not a secure method of sending data since the data is passed through as part of the URL, which will show up in the web server’s logfile.
The advantage of the GET method is the page can be retrieved again by entering the URL.
For example, after submit the keywords: PHP
and MySQL
to the Yahoo, the URL is changed to the following string:
http://search.yahoo.com/search?p=PHP+MySQL&ei=UTF-8
and the variable values are $_GET[p]
= “PHP MySQL” and $_GET[ei]
= “UTF-8” if the Yahoo Search uses PHP.
Spaces and some special characters are not allowed in URLs.
The code ‘+’ is for the space ‘ ’ and the hexadecimal ASCII code ‘%40’ is for the symbol ‘@’ in URLs.