Query string
From DocForge
A query string is the last part of a URL following an optional question mark ("?"). It contains a set of key/value pairs of parameters to be passed along with a page request. These parameters can be interpreted by a server or client script for various purposes, most often to choose what content to display on a page.
Syntax [edit]
Each key and its associated value in the string is separated by an equal symbol ("="). Each set of key / value pairs is separated by an ampersand ("&"). All of the query string parameters follow a question mark. Keys may repeat, but typically the last value associated with a given key is the one recognized by the running application.
The simplest syntax for a query string includes simple pairs of keys and values. For example:
http://example.com/page?key=value&key2=value2
Keys may also represent arrays by adding square brackets ("[" and "]"). The brackets can be empty, representing automatic numeric indexing. Or within the brackets can be numbers or letters as indexes. For example:
http://example.com/page?key[0]=value&key[1]=value http://example.com/page?key[first]=value&key[second]=value
PHP [edit]
In the PHP programming language, query string values are parsed by the runtime environment and are made available to the running script as get parameters. These can all be accessed using the superglobal array $_GET.
For example, the query string key=value&key2=value2 is available to a PHP script as $_GET["key"] == "value" and $_GET["key2"] == "value2". Query strings with brackets are available as nested arrays. For example, key[0]=value&key[1]=value is accessed through $_GET["key"][0] and $_GET["key"][1].

