PHP provides the superglobal arrays. They allow you to specify where the input data came from.
- $GLOBALS: Contains a reference to every variable currently available within the global scope of the script. The keys of this array are the names of the global variables.
- $_COOKIE: Values provided to the script with cookies.
- $_GET: A global associative array of variables passed to the script via the HTTP GET method.
- $_POST: A global associative array of variables passed to the script via the HTTP POST method.
- $_FILES: Variables provided to the script via HTTP POST file uploads
- $_SERVER: Variables set by the Web server.
- $_ENV: Variables provided to the script via the environment.
- $_REQUEST: Variables provided to the script via the GET, POST, and COOKIE input types (not considered safe).
- $_SESSION: Variables currently registered to a script's session.
To check the value of a GET submitted field, use $_GET[field]. Likewise, $_POST[field] is used to access a field when using the POST method.