: Hi,
: I've created a list box in ASP that's populated with the 12 months. Upon user selection, I will save the month.
:
:
: <select name="month" size="1">
: <option value="3">March</option>
: <option value="4">April</option>
: <option value="5">May</option>
: <option value="6">June</option>
: </select>
:
:
: The user can also modify the value in the future. Here's where my problem crops up.
:
: How do I "select" the month name that was previously saved into the database?
:
: The only method I could find was:
:
:
:
: <%If mth = "1" Then%><option value="1" selected>January<%Else%><option value="1">January<%End If%></option>
:
:
:
: Does anyone have a simpler method because I have many listboxes!!
:
: Thanks in advance.
:
------------------------------------------------------------
You could also use a for loop for the months and then set an array with the months in it.
Dim month(11)
month(0) = "January"...-all the way to -...month(11)= "December"
<% for x = 1 to 12 %>
<option value = " <%=x%> "><%=month(x)%></option>
<% Next %>
That'll do it...