Forside > PHP > PHP $_GET

PHP: $_GET

By Kristoffer Bohmann

How $_GET data work.

  • $_GET is an associative array of variables.
  • $_GET usually passes data from one page to another (links, form data etc.).
  • $_GET can also be sent in the background as AJAX data (so the user is never redirected to another page).
  • $_GET is sent via the URL parameters.
  • $_GET is a superglobal and is therefore available in all scopes throughout a script (can be accessed from all functions, objects etc.).
  • $_GET data received from a public websites should not be trusted by the system (it is necessary to make the data "safe" and remove potential security threats before inserting into the database).
  • $_GET data is normally visible to the user in the URL.
  • $_GET is considered less secure than $_POST.
  • Result pages using $_GET data can be bookmarked by the user.
  • $_GET data is also available in the $_REQUEST varible.