PHP » Predefined Variables » GET variables

Syntax:
$_GET

The $_GET array contains variables passed to the server in a HTTP GET request. These variables are passed to the server as part of the URL.

Examples

Code:
<a href="vars_get.php?my_var=Hello">Click to reload the page</a>
<br>

<?php

@print "Data: " . $_GET["my_var"];

?>
Output:
Click to reload the page
Data: Hello
Explanation:

The document must be named vars_get.php. When the page is first loaded, there is no data to be printed. If it is reloaded with the link, the GET data in the URL is displayed.

See Also: