Jump to content

Querystring

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Runtime (talk | contribs) at 23:43, 18 May 2006 (Querystring format conventions). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

For dynamic webpages, when value-keys are passed between a web client (usually a Web browser) and the server, this info can be passed through two methods. First, for HTTP GET requests, the URL used has a querystring appended to it that the web server, through naming conventions, separates and passes to the dynamic page. Secondly, for HTTP POST requests, value-key pairs are passed as separate parts of the HTTP request.

Querystring format conventions

The querystring and the regular components of the URL are separated by a question mark (?). After that, pairs of key=value pairs follow, separated by ampersand (&) characters. Characters that are not valid parts of a request string are encoded into alternate forms (and usually decoded by the dynamic page) according to a static set of rules. An example URL with a querystring follows:

http://localhost/cart/example.php?lang=en&size=10&uid=50

In this example, there are three key-value pairs:

  • lang has the value "en"
  • size has the value "10"
  • uid has the value "50"