PDA

View Full Version : Drop Down Question


FlyingL0
05-30-2003, 12:51 PM
I have a drop down currently on my web page that is populated from a database with numerical values. However in the table there are also Names that are associated with the number values. I would like to select the name from the dropdown and have its numerical value past to the form instead of the name. Below is the current code that builds the drop down.

dept_account is the number value dept_account_disc is the name i want shown in the dropdown.

sqlstring1= "SELECT * FROM deptaccount"
SET RS = Con.Execute( sqlstring1 )

'Response.Write("</select>")
Response.Write("-")
Response.Write("<select name=daccount" & I & " >")
Response.Write("<option value=" & daccount(I) & "> " & daccount(I) & " ")


WHILE NOT RS.EOF
Response.Write("<option value=" & RS("dept_account" ) & ">" & RS( "dept_account" ) & "")
RS.MoveNext
WEND
RS.close
set RS = Nothing

Angelika
05-30-2003, 01:12 PM
try this:

WHILE NOT RS.EOF
Response.Write("<option value='" & RS("dept_account " ) & "'>" & RS( "dept_account_disc" ) & "</option>")
RS.MoveNext
WEND
RS.close
set RS = Nothing

FlyingL0
05-30-2003, 01:21 PM
Thanks!