URL parameters

URL parameters

A URL parameter is a name/value pair appended to a URL. The parameter begins with a question mark (?) and takes the form name=value. If more than one URL parameter exists, each parameter is separated by an ampersand (&). The following example shows a URL parameter with two name/value pairs:

http://server/path/document?name1=value1&name2=value2

URL parameters let you pass user-supplied information from the browser to the server. When a server receives a request, and parameters are appended to the URL of the request, the server puts the parameters at the disposal of the requested page before serving that page to the browser.

In this example, imagine that the application is a web-based storefront. Because the developers of the site want to reach the widest possible audience, they have designed the site to support foreign currencies. When users log in to the site, they can select the currency in which to view the prices of the available items.

  1. The browser requests the page report.cfm from the server. The request includes the URL parameter Currency="euro". The Currency="euro" variable specifies that all monetary amounts retrieved be displayed as the European Union euro.
  2. The server temporarily stores the URL parameter in memory.
  3. The report.cfm page retrieves and uses the parameter to retrieve the cost of items in euros. These monetary amounts can either be stored in a database table of different currencies, or converted from a single currency associated with each item (any currency supported by the application).
  4. The server sends the report.cfm page to the browser, and displays the value of items in the requested currency. When this user terminates the session, the server destroys the value of the URL parameter, freeing up server memory to hold the requests of new users logging in to the site.

    The following illustration shows how an application server processes a URL parameter.

URL parameters are created when the HTTP’s GET method is used in conjunction with an HTML form. The GET method specifies that the parameter value be appended to the URL request when the form is submitted.

Typical uses of URL parameters include personalizing websites based on a user’s preferences. For example, a URL parameter consisting of a user name and password can be used to authenticate a user, displaying only information that user has subscribed to. Common examples of this include financial websites that display individual stock prices based on stock market symbols the user has previously chosen. Web application developers commonly use URL parameters to pass values to variables within applications. For example, you could pass search terms to SQL variables in a web application to generate search results.

Related topics

  • Creating URL parameters using HTML links
  • Retrieving form and URL parameters


Getting Started with Dreamweaver
Dreamweaver Basics
Working with Dreamweaver Sites
Laying Out Pages
Adding Content to Pages
Working with Page Code
Preparing to Build Dynamic Sites
Making Pages Dynamic
Defining Sources of Dynamic Content
Developing Applications Rapidly