I have a drop down list (in a form) made from a query to a database but when I try to use the form result in the action statement, it holds old data. See my code:
<form name="frmCategoryName" method="Post" action="businesses.asp?Category=<%=Request.Form("SelectedCategory")%>">
What category of business do you want to see? <SELECT size="1" name="SelectedCategory" onchange=frmCategoryName.submit()>
<%
Do While not rsCategories.EOF
If Request.Form("frmCategoryName") = rsCategories("CategoryName") then
Response.Write ("<option value=" & rsCategories("CategoryName") & "SELECTED>" & rsCategories("CategoryName") & "</option>")
else
Response.Write ("<option value=" & rsCategories("CategoryName") & ">" & rsCategories("CategoryName") & "</option>")
end if
rsCategories.MoveNext
Loop
rsCategories.Close
%>
</SELECT></form>
Problem is when you change your selection, the previous value of SelectedCategory gets sent in the call to businesses.asp instead of the current value. How do I make it so that the current value is sent?
<form name="frmCategoryName" method="Post" action="businesses.asp?Category=<%=Request.Form("SelectedCategory")%>">
What category of business do you want to see? <SELECT size="1" name="SelectedCategory" onchange=frmCategoryName.submit()>
<%
Do While not rsCategories.EOF
If Request.Form("frmCategoryName") = rsCategories("CategoryName") then
Response.Write ("<option value=" & rsCategories("CategoryName") & "SELECTED>" & rsCategories("CategoryName") & "</option>")
else
Response.Write ("<option value=" & rsCategories("CategoryName") & ">" & rsCategories("CategoryName") & "</option>")
end if
rsCategories.MoveNext
Loop
rsCategories.Close
%>
</SELECT></form>
Problem is when you change your selection, the previous value of SelectedCategory gets sent in the call to businesses.asp instead of the current value. How do I make it so that the current value is sent?