3/20/15

PHP Super Global Variables



PHP super global variable is used to access global variables from anywhere in the PHP script.
PHP Super global variables is accessible inside the same page that defines it, as
well as outside the page.
while local variable’s scope is within the page that defines it.
The PHP super global variables are :
$_GET[“FormElementName”] : It is used to collect value from a form(HTML script) sent with method=’get’.
information sent from a form with the method=’get’ is visible to everyone(it display on the browser URL bar).
$_POST[“FormElementName”] : It is used to collect value in a form with method=”post”>. Information sent from a form is invisible to others.(can check on address bar)
$_REQUEST[“FormElementName”] : This can be used to collect data with both post and get method.
$_FILES[“FormElementName”] : It can be used to upload files from a client computer/system to a server.
OR
$_FILES[“FormElementName”][“ArrayIndex”] : Such as File Name, File Type, File Size, File temporary name.
$_SESSION[“VariableName”] : A session variable is used to store information about a single user, and are available to all pages within one application.
$_COOKIE[“VariableName”] : A cookie is used to identify a user. cookie is a small file that the server embedded on user computer.
$_SERVER[“ConstantName”] : $_SERVER holds information about headers, paths, and script locations.
eg. $_SERVER[“SERVER_PORT”], $_SERVER[“SERVER_NAME”],$_SERVER[“REQUEST_URI”]

  1 comment:

FIND US ON FACEBOOK

FIND US ON Twitter