View Full Version : Creating a request.querystring
Anthony1312002
02-22-2005, 02:45 PM
Has anyone come across an example that shows how to create a request.querystring using a combo box in ASP?
tboss132
02-22-2005, 05:07 PM
Please expantiate more on the problem you're having. I don't understand what you mean by creating a request.querystring using a combo box. Probably you have a form with a combo box and you want to use the value in your querystring?
Morgoth
02-23-2005, 10:37 PM
Here you go.
I hope this helps you.
Copy and Save this as a refferance!!!
I named the page "test.asp". Use this name too test it first. This code works, so don't edit it yet.
<html>
<head>
<title>Query My Combo Box</title>
</head>
<body>
<form method="get" action="test.asp">
<table align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center">
<select name="QueryName">
<option value="United States">United States</option>
<option value="Canada">Canada</option>
</select>
</td>
</tr>
<tr>
<td align="center"><input type="submit" value=" Submit "></td>
</tr>
</table>
</form>
<%
If Request.ServerVariables("QUERY_STRING") <> "" Then
Response.Write "You have selected: " & Request.QueryString("QueryName") & "<br>"
Response.Write "The entire query string is: " & Request.ServerVariables("QUERY_STRING")
End If
%>
</body>
</html>
Add another combo box for 2 query strings, but remember to change the name. Take a look here:
<html>
<head>
<title>Query My Combo Box</title>
</head>
<body>
<form method="get" action="test.asp">
<table align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center">
<select name="QueryName">
<option value="United States">United States</option>
<option value="Canada">Canada</option>
</select>
</td>
</tr>
<tr>
<td align="center">
<select name="SecondQueryName">
<option value="Dollar">US Dollar</option>
<option value="Loonie">Canadian Loonie</option>
</select>
</td>
</tr>
<tr>
<td align="center"><input type="submit" value=" Submit "></td>
</tr>
</table>
</form>
<%
If Request.ServerVariables("QUERY_STRING") <> "" Then
Response.Write "You have selected: " & Request.QueryString("QueryName") & "<br>"
Response.Write "You have selected Second: " & Request.QueryString("SecondQueryName") & "<br>"
Response.Write "The entire query string is: " & Request.ServerVariables("QUERY_STRING")
End If
%>
</body>
</html>
Reply if you have problems.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.