A useful feature of PHP is the way it handles PHP forms. A very important principle to understand is that any element of the form automatically takes effect in the PHP script.
Example#1 a simple HTML form
There is no special place in the form where no special identifiers are used. When the user fills out the form and clicks the submit button, the page action.php will be called. In this file, you can add the following content:
Example#2 printing data from a form
Hello, .
You're a year old.
The output of the script might be: Hello, Joe. You are 22 years old.
$_get usage:
Using get forms is similar, except to use the appropriate get pre-defined variables. GET also applies to query_string (URL in the "?" After the information). So, for example, http://www.example.com/test.php?id=3 contains get data that can be accessed using $_get[' ID '.
All variables that can be obtained by $_get and $_post can be obtained by $_request.
The PHP hyper-global variable $GLOBALS contains a reference to a globally valid variable that refers to each current script. The key name of the array is the name of the global variable. $GLOBALS array exists starting with PHP 3. The $_server variable is set by the Web server or directly associated with the execution environment of the current script. Similar to the old array $HTTP _server_vars array (still valid but opposed to use). $_get A variable that is submitted to the script via a URL request. Similar to the old array $HTTP _get_vars array (still valid but opposed to use). $_post The variables that are submitted to the script via the HTTP POST method. Similar to the old array $HTTP _post_vars array (still valid but opposed to use). $_cookie The variables that are submitted to the script via the HTTP cookie method. Similar to the old array $HTTP _cookie_vars array (still valid but opposed to use). $_files The variables submitted to the script via an HTTP POST file upload. Similar to the old array $HTTP _post_files array (still valid but opposed to use). For more information, see POST method uploads. $_env The variables that the execution environment submits to the script. Similar to the old array $HTTP _env_vars array (still valid but opposed to use). $_request is submitted to the script through the get,post and COOKIE mechanism, so the array is not trustworthy. The presence or absence of all variables contained in the array and the order of the variables are defined by the Variables_order configuration instructions in php.ini. This array does not have a direct corresponding version before PHP 4.1.0. See Import_request_variables ().
$_session
The variable currently registered to the script session. Similar to the old array $HTTP _session_vars array (still valid but opposed to use). For more information, refer to the Session processing functions section.