The QueryString collection
The queryString collection contains any information
which is added to the URL after the file name. For instance, given
a URL of
http://www.trading.com/login.cgi?firstname=harry&lastname=potter
The QueryString collection would contain two items:
firstname with a value of "harry" and
lastname with a value of "potter"
The "?" is used to signal the beginning of the querystring.
A second way of generating a querystring is by using
a Form wi ht a Get method instead of a Post method. For example,
using the Form from <<<link>>, but instead of using
the post method, we will us the GET method.
<form action="IfThenAction.asp" method="GET">
Please choose your preference in month, either March or April:<br>
<input type="text" Name="monthpref"><p>
Please input your preference in location, either East or West<br>
<input type="text" name="location">
<br>
<input type="submit"><input type="reset">
</form>
If we assume the user enters April for MonthPref
and East for location, the URL generated from this will look something
like:
http://www.yourwebsite.com/IfThenAction.asp?MonthPref=April&Location=East
Retrieving a QueryString
Retrieve All name/value pairs
<% strList=Request.QuerySTring%>
Retrieve a specific item
<% strList=Request.QueryString("iterm_name")%>
Where item_name is the name set in the requesting form. In the above example,
we would retrieve MonthPref and Location as follows:
<% strMonthPref=REquest.QueryString("MonthPref")
%>
<% strLocation =Request.QueryString("Location")%>
|