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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Highlighting V alues in a Drop Down Box - Database

Status
Not open for further replies.

Bipasha

Programmer
Feb 28, 2001
23
US
This is the code I have to display a drop down box with values from 1 to 100

<select name=&quot;reports&quot;>
<option selected value=&quot;1&quot;>1</option>
<% for i = 2 to 100 %>
<option value=&quot;<%=i%>&quot;><%=i%></option>
<% next
i = i + 1
%>

Suppose I insert (value=45) for reports into a database. The next time I view this drop down box for that particular report....I want 45 to be selected (highlighted) instead of 1 (which is the default)

I tried doing this:
------------------
<select name=&quot;reports&quot;>
<% for i = 1 to 100 %>
If Session(&quot;val&quot;) = i then
<option selected value=&quot;<%=Session(&quot;val&quot;)%>&quot;><%
=Session(&quot;val&quot;)%></option>
<% Else %>
<option value=&quot;<%=i%>&quot;><%=i%></option>
<% End If
next
i = i + 1
%>

Can somebody help me with this problem??

 
I tried a lot of methods, but nothing seems to be working. Could anyone please help me with this.
 
Your:

If Session(&quot;val&quot;) = i then

is not inside <% %> [sig][/sig]
 
Hi Chris,

That was a typing mistake....although in my program that statement is enclosed by <% %>.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top