Query strings are an excellent way to pass data between pages. This tutorial will give you a basic understanding of using a query string to send information to different page.
Nuts Own Code

Asp Directory

Nuts Web Search
Web Directory
Web Search

Nuts ASP Code
Functions
Scripts
Tutorials
Wizards
Fonts
Download Fonts
Download Dll Files
Dll Files
Relaxing Games
Online Games
Take Our Poll
Do you use .Net?
Yes
No
Not Yet
Dot What?
Really, Take It!
Get The Source
About Nuts4Asp
Privacy
Contact Us
Arts
Movies, Television, Music
Business
Jobs, Industries, Investing
Computers
Internet, Software, Hardware
Games
Video Games, RPGs, Gambling
Health
Fitness, Medicine, Alternative
Home
Family, Consumers, Cooking
Kids and Teens
Arts, School Time, Teen Life
News
Media, Newspapers, Weather
Reference
Maps, Education, Libraries
Regional
US, Canada, UK, Europe
Science
Biology, Psychology, Physics
Sports
Baseball, Soccer, Basketball
World
Deutsch, Español, Français, Italiano, Japanese, Nederlands, Polska, Svenska
Help build the largest human-edited directory of the web
Lets look at the first part of this now. In the below example we will pass various colors from this page to another. While this may not have many practical implications, it will serve the purpose just as well.

Now then select a color below by clicking the appropriate link. This will open a new window and display your color by making it the background color of the page.

  1. Yellow
  2. Lime Green
  3. Fuchsia

And here is the source for the links above:

<ol>
<li><a href="pop.asp?color=yellow">Yellow</a></li>
<li><a href="pop.asp?color=lime">Lime Green</a></li>
<li><a href="pop.asp?color=fuchsia">Fuchsia</a></li>
</ol>

Now let me explain a bit here.

href="pop.asp?color=yellow"

pop.asp is the name of the page we are sending the info to. The question mark ? in the link is what indicates there is a bit of info being passed. It denotes that the query string we are sending is named color. The equal sign = indicates the the information being passed in the query string named color is yellow.

Now let's view the source of pop.asp and see how it works.

First we REQUEST the QUERYSTRING named COLOR and dimension it as clr.
<%
Dim clr
clr = Request.QueryString("color")
%>
<html>
<head>
Now in the title tag we use clr to title the page
<title>You picked&nbsp;<%=clr%></title>
</head>
In the body tag we use clr to set the background color.
<body bgcolor="<%=clr%>">
Finaly in the heading tag clr is used to write the color on the page.
<h2>The color you selected was <%=clr%></h2>
</body>
</html>

Simple huh?

Learn how to use query strings in dealing with databases. You can use them to ADD, DELETE, or EDIT records in your tables.

Bad or missing query parameters in request.

Copyright © 2001-2008 Nuts4Asp.com
All other names used are property or copyright of their respective owners.