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!

Add rst to Select box

Status
Not open for further replies.

riarc

Programmer
Dec 6, 2001
44
US
I know this is a simple question, but I am very new to asp.
How do I add the values from a recordset to a select box.
I know VB so I tried to use add item but that didn't work.
this is what I got so far.
How do i get write the rst to the locations select box?

<DIV align=&quot;center&quot;>
<SELECT name=&quot;locations&quot;>
<option>Select a Location</option>
<INPUT type=&quot;submit&quot;, value=&quot;Go&quot;/>
</DIV>
<%
DO while not rstlocations.EOF
Response.Write (rstlocations(&quot;loc_cd&quot;))
response.write(&quot;</br>&quot;)
rstlocations.MoveNext
loop
 
<DIV align=&quot;center&quot;>
<SELECT name=&quot;locations&quot;>
<option>Select a Location</option>
<%
Dim optionNumber
optionNumber = 0

DO while not rstlocations.EOF
optionNumber = optionNumber + 1

response.write(&quot;<option value='&quot; & optionNumber & &quot;'>&quot;)
Response.Write (rstlocations(&quot;loc_cd&quot;))
response.write(&quot;</option>&quot;)

rstlocations.MoveNext

loop
%>
</SELECT><BR>

<INPUT type=&quot;submit&quot;, value=&quot;Go&quot;/>
</DIV>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top