PHP Superglobal variables
Superglobal variables are available in all scopes throughout a script.
The PHP super global variables are :
$GLOBALS
$_SERVER
$_GET
$_POST
$_FILES
$_COOKIE
$_SESSION
$_REQUEST
$_ENV
the most frequently used of these are:
- $_SERVER['QUERY_STRING']
The query string, if any, via which the page was accessed.
- $_GET[“FormElementName”]
It is used to collect value from a form with method='get'.
- $_POST[“FormElementName”]
It is used to collect value in a form with method='post'.
- $_REQUEST[“FormElementName”]
This can be used to collect data with both post and get method
- $_SERVER['PHP_SELF']
The filename of the currently executing script,example:http://lautturi.com/foo/bar.php(/foo/bar.php)
- $_FILES
HTTP File Upload variables
- $_SESSION['variableName']
It is used to store session information
- $_COOKIE
HTTP Cookies
you can use var_dump()
to get more information
<?php
var_dump($GLOBALS);
var_dump($_SERVER);
?>