Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option List Values displaying wrong 1

Status
Not open for further replies.

dom24

Programmer
Aug 5, 2004
218
0
0
GB
Can anyone tell me where i'm going wrong with this code:

<SELECT NAME="day">
<%For i = 1 to 31
d_options = d_options & "<option"
If Request.QueryString("day") = i then
If Request.QueryString("day") > "28" and Request.QueryString("month") = "2" and Request.QueryString("year") <> "2008" Then
d_options = d_options & " selected>" & "28" & "</option>"
ElseIf Request.QueryString("day") > "29" and Request.QueryString("month") = "2" and Request.QueryString("year") = "2008" Then
d_options = d_options & " selected>" & "29" & "</option>"
Else d_options = d_options & " selected>" & Request.QueryString("day") & "</option>"
End if
Else
d_options = d_options & ">" & i & "</option>"
End if

Next
Response.Write d_options
%>
</SELECT>

I'm getting a list of numbers 1 to 31, but it's not adding SELECTED to the option tag when it should.

Thanks.
 
trying putting CInt(Request.QueryString("day")). same for month and year. This will force the querystring values into integers which is recommended for numeric comparisons

Tony
________________________________________________________________________________
 
Even though the values being passed are already numeric?
 
Still doesn't select the value being passed.
 
Sorry I take that back (put it in the wrong place!) you're absolutely right! thanks so much. :0)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top