select box

Results 1 to 2 of 2

Thread: select box

  1. #1
    Join Date
    Dec 1969

    Default select box

    I have a registration form where the user gets to submit his date of birth which is statically fed in the form e.g<BR>Date &#060;option value=1&#062;1 <BR>Month &#060;option value=Jan&#062; Jan<BR>YEar &#060;option value=1900&#062; 1900<BR>and i store it in databse. I am making a edit registration page. How do i make the date of birth selected with the other dates months and years also remaining in the form. <BR><BR>thnx <BR>brij<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: select box

    try this, you&#039;ll need to create an array that holds all the values possible, and when you&#039;re looping through the array filling the select box, you check each value with the value from the db, when you find it, write out the "selected" property for its option. confused? like this:<BR><BR>dim sArr(3), i, str, sSt<BR><BR>sArr(0) = "CA"<BR>sArr(1) = "HI"<BR>sArr(2) = "OR"<BR>sArr(3) = "NV"<BR><BR>&#039; do db stuff<BR><BR>sSt = ucase(rs("State"))<BR>response.write "&#060;select name=""ST""&#062;" & vbcrlf<BR>for i = 0 to ubound(sArr)<BR>str = ""<BR>if (sSt = sArr(i)) then str = "selected"<BR>response.write "&#060;option value=""" & sArr(i) & """ " & str & "&#062;" & sArr(i) & "&#060;/option&#062;" & vbcrlf<BR>next<BR>response.write "&#060;/select&#062;" & vbcrlf<BR>...<BR>&#039; close and dispose<BR><BR><BR>hope this helps,<BR>justin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts