Everything so far has been about variables you create. Superglobals are different — they're built-in associative arrays PHP fills in automatically, carrying information about the actual web request currently being handled. This is where PHP stops being "just a scripting language" and starts being specifically a web scripting language.
| Superglobal | Contains |
|---|---|
| $_GET | Data sent in the URL's query string (?name=value) |
| $_POST | Data sent in a form submission's body |
| $_SERVER | Information about the server and the current request (URL, method, headers) |
| $_SESSION | Data that persists across multiple page visits for one visitor (needs session_start()) |
| $_COOKIE | Small pieces of data stored in the visitor's browser between visits |
| $_FILES | Information about any file the visitor uploaded |
The next several lessons cover the most-used ones — $_GET/$_POST, then $_SESSION/$_COOKIE — in real depth. This lesson is the map before the detail.
<?php
// If the URL is page.php?name=Priya
echo $_GET["name"]; // "Priya"
?><?php
echo $_SERVER["REQUEST_METHOD"]; // "GET" or "POST"
echo $_SERVER["PHP_SELF"]; // the current script's path
?>Superglobal data is never trusted by default
Every superglobal holds data that came from outside your script — the visitor, their browser, or the request itself. Never trust it blindly: a value in $_GET or $_POST can be absolutely anything, including something malicious, regardless of what a form was designed to send. Validation and security get their own lesson later in this section.