YouTip LogoYouTip

Coll Querystring

# ASP QueryString Collection * * Complete Request Object Reference Manual](#) * * * The QueryString collection is used to retrieve variable values from the HTTP query string. The HTTP query string is defined by the value following the question mark (?), for example: Link with a query string The code above would generate a variable named `txt` with the value "this is a query string test". Query strings can also be generated via form submissions, or by users typing queries into the browser's address bar. **Note:** If you need to post large amounts of data (over 100kb), you cannot use `Request.QueryString`. ## Syntax Request.QueryString(variable)[(index)|.Count] | Parameter | Description | | --- | --- | | variable | Required. The name of the variable to retrieve from the HTTP query string. | | index | Optional. Specifies one of multiple values for a variable. Ranges from 1 to Request.QueryString(variable).Count. | * * * ## Examples ### Example 1 Iterate through all values of variable `n` in the query string: Assume the following request is sent: http://www.w3cschool.cc/test/names.html?n=John&n=Susan And `names.asp` contains the following code: <% for i=1 to Request.QueryString("n").Count Response.Write(Request.QueryString("n")(i) & "
") next %> The file `names.asp` would display: John Susan ### Example 2 Assume the following string is sent: http://www.w3cschool.cc/test/names.html?name=John&age=30 The code above produces the following QUERY_STRING value: name=John&age=30 Now, we can use this information in our script: Hi, . Your age is . Output: Hi, John. Your age is 30. If you do not specify any variable values to display, like this: Query string is: The output would be: Query string is: name=John&age=30 * * Complete Request Object Reference Manual](#)
← Coll ServervariablesColl Form β†’