You're setting RegID out of the Do While Not RS.EOF, so therefore it is never being set, or it is being set to the first record only.
Move it down to within the do while not rs.eof.
SQL = "SELECT * FROM tbregion ORDER BY region ASC"
Set RS = Server.CreateObject("ADODB.recordset")
RS.Open SQL,Conn
Session("region") = Request.Form("regv")
region = Session("region")
%>
<form name="region" action="select_menu.asp" method="post">
<select name="regv" onchange="region.submit()">
<option value="">Make a selection</option>
<option value="">------------------</option>
<%
RegID = RS("regionID")
x=0
Do While Not RS.EOF
If RegID = region Then
For i = 1 To Region
Response.Write("<option value='" & RS("regionID") & "' SELECTED>" & RS("region") & "</option>")
x=x+1
Next
Else
x=x -1
For i = 1 To RegID
Response.Write("<option value='" & RS("regionID") & "'>" & RS("region") & "</option>")
Next
End If
RS.MoveNext
Loop
RS.Close
Set RS = Nothing
%>
</select>
</form>
<%
Response.Write("<a href='category.asp?clevel=1®v="& region & "'>Link</a>")
%>
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
I don't understand, please explain a little more.
By changing the mode to POST for the form, nothing will be put in the querystring. You can then check for the form to see if it was submitted by using the request.form method.
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
Also, try adding hidden input fields. It should still send the value through querystring with the GET method.
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68
Put the form as POST, otherwise your querystring will be overridden. Then for your form action put :
action="<%= Request.ServerVariables("SCRIPT_NAME") & "?" & Request.ServerVariables("QUERY_STRING") %>"
SheSaidImaPregy
Veteran Poster
1,080 posts since Sep 2007
Reputation Points: 43
Solved Threads: 68