I have a form with a drop down box that calles the page it is on (business.asp) with the selected value. The call (URL) is fine but once the page reloads, it never has the selected category "selected".
Here's the code:
intCategoryID = Request.QueryString("SelectedCategory")
<form name="frmCategoryName" method="Put" action="businesses.asp">
What category of business do you want to see? <SELECT size="1" name="SelectedCategory" onchange=frmCategoryName.submit()>
<%
Do While not rsCategories.EOF
If intCategoryID = rsCategories("ID") then
Response.Write ("<option value=" & rsCategories("ID") & "selected>" & rsCategories("CategoryName") & "</option>")
else
Response.Write ("<option value=" & rsCategories("ID") & ">" & rsCategories("CategoryName") & "</option>")
end if
rsCategories.MoveNext
Loop
rsCategories.Close
%>
</SELECT></form>
The red line above never gets executed. I have confirmed that intCategoryID holds a valid ID and that it does indeed match a rsCategory("ID"). When I make a selection from the drop down box, my address changes appropriately but the value selected in the drop down box always goes back to the the first available option.
Here's the code:
intCategoryID = Request.QueryString("SelectedCategory")
<form name="frmCategoryName" method="Put" action="businesses.asp">
What category of business do you want to see? <SELECT size="1" name="SelectedCategory" onchange=frmCategoryName.submit()>
<%
Do While not rsCategories.EOF
If intCategoryID = rsCategories("ID") then
Response.Write ("<option value=" & rsCategories("ID") & "selected>" & rsCategories("CategoryName") & "</option>")
else
Response.Write ("<option value=" & rsCategories("ID") & ">" & rsCategories("CategoryName") & "</option>")
end if
rsCategories.MoveNext
Loop
rsCategories.Close
%>
</SELECT></form>
The red line above never gets executed. I have confirmed that intCategoryID holds a valid ID and that it does indeed match a rsCategory("ID"). When I make a selection from the drop down box, my address changes appropriately but the value selected in the drop down box always goes back to the the first available option.