Skip to main content

The $_GET value is created automatically with the existence of a query string within a URL, or if a form is submitted with the GET method (which still uses the URL as its vehicle). Any information that is sent along the query string in a key/value pair is subsequently loaded into the $_GET array in the called page.

// Example URL: http://www.mynewwebsite.com/access.php?login=1&logname=Fred

$login   = $_GET['login'];
$logname = $_GET['logname'];

if ($login == 1) {
  echo "Welcome " . $logname;
} else {
  echo "login failed... please try again " . $logname;
}