list box

Hi,
I've created a list box in ASP that's populated with the 12 months. Upon user selection, I will save the month.

[code]

March
April
May
June

[/code]

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:

[code]

<%If mth = "1" Then%>January<%Else%>January<%End If%>

[/code]

Does anyone have a simpler method because I have many listboxes!!

Thanks in advance.

Comments


  • : <%
    '--- Get the value from the Database. Now I had taken the value as static
    DOBdd = "5"
    %>


    March
    April
    May
    June


    document.theform.month.value="<%=dobdd%>"



  • : Hi,
    : I've created a list box in ASP that's populated with the 12 months. Upon user selection, I will save the month.
    :
    : [code]
    :
    : March
    : April
    : May
    : June
    :
    : [/code]
    :
    : 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:
    :
    : [code]
    :
    : <%If mth = "1" Then%>January<%Else%>January<%End If%>
    :
    : [/code]
    :
    : 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 %>
    "><%=month(x)%>
    <% Next %>

    That'll do it...

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories