|Lessons||PHP $_GET Variable|
In other words the $_GET variable is an array of variable names and values sent by the HTTP GET method. Please remember that the information sent from a form with the GET method is visible to everyone i.e. it is displayed in the browser's address bar and it also has limits on the amount of information to send.
<form action="phpGET.php" method="get">
Name: <input type="text" name="name" /><br>
Occupation: <input type="text" name="occ" /><br>
<input type="submit" />
When you click the "Submit" button, the internet browser would take you to a URL looking something like:
The "phpGET.php" file can now use the $_GET variable to catch the form data as shown below (notice that the names of the form fields will automatically be the ID keys in the $_GET array):
$name = $_GET["name"];
$occupation = $_GET["occ"];
Be careful when using the html form method "get", as all variable names and values are displayed in the URL. So this method should not be used when sending passwords or other sensitive information to the server! The HTTP GET method is also not suitable on large variable values, as there is a limit on the length of a URL.
Next: PHP $_post