ASP QueryString Collection
Complete Request Object Reference
The QueryString collection is used to retrieve the variable values in the HTTP query string.
The HTTP query string is specified by the values following the question mark
(?), like this:
<a href= "test.asp?txt=this is a query string test">Link with a
query string</a>
The line above generates a variable named txt with the value "this is a
query string test".
Query strings are also generated by form submission, or by a user typing a query into the address
bar of the browser.
Note: If you want to send large amounts of data (beyond 100 kb) the Request.QueryString cannot be used.
Syntax
|
Request.QueryString(variable)[(index)|.Count]
|
| Parameter |
Description |
| variable |
Required. The name of the variable in the HTTP query string to
retrieve |
| index |
Optional. Specifies one of multiple values for a variable. From 1 to
Request.QueryString(variable).Count |
Examples
Example 1
To loop through all the n variable values in a Query String:
The following request is sent:
|
http://www.w3schools.com/test/names.asp?n=John&n=Susan
|
and names.asp contains the following script:
<%
for i=1 to Request.QueryString("n").Count
Response.Write(Request.QueryString("n")(i) & "<br />")
next
%>
|
The file names.asp would display the following:
Example 2
The following string might be sent:
|
http://www.w3schools.com/test/names.asp?name=John&age=30
|
this results in the following QUERY_STRING value:
Now we can use the information in a script:
Hi, <%=Request.QueryString("name")%>.
Your age is <%= Request.QueryString("age")%>.
|
Output:
|
Hi, John. Your age is 30.
|
If you do not specify any variable values to display, like this:
|
Query string is: <%=Request.QueryString%>
|
the output would look like this:
|
Query string is: name=John&age=30
|
Complete Request Object Reference
Make your web applications look like a million bucks
|
|
Most web applications today use boring methods to present data to their viewers using grids or simple HTML tables. FusionCharts induces "life" into the web applications by converting monotonous data into lively charts, gauges & maps.
FusionCharts works with all technologies like ASP, ASP.NET, PHP, ColdFusion, Ruby on Rails, JSP, HTML pages etc.
and connects to any database to render animated & interactive charts. It takes less than 15 minutes and no expertise
whatsoever to build your first chart and just a glance of it to captivate your audience. This fact is endorsed by our
12,000 customers and 150,000 users which include a majority of the Fortune 500 companies.
And yeah, your applications could look like a million bucks by spending just $69.
So go ahead, download your
copy of FusionCharts and start "wow-ing" your customers now!
|
 |
W3Schools' Online Certification Program
The perfect solution for professionals who need to balance work, family, and career building.
More than 4000 certificates already issued!
|
The HTML Certificate documents your knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
|