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!

Dropdown list default value

Status
Not open for further replies.

CortoMaltes

Programmer
Mar 30, 2000
22
0
0
GR
Hi,
How can I make sure that my combo box (not dynamic) default value is set to the value found in the database table (i.e. option selected?
Thanks
 
You will need to loop through the db results to match the select box

response.write &quot;<select>&quot;
if txtResultFromDB = &quot;home&quot; then
response.write &quot;<option value=home selected>home</option>&quot;
else
response.write &quot;<option value=home>home</option>&quot;
end if

if txtResultFromDB = &quot;away&quot; then
response.write &quot;<option value=away selected>away</option>&quot;
else
response.write &quot;<option value=away>away</option>&quot;
end if
response.write </select>&quot;

It's hard and is long and tedious, but it is the only way I can think of to make it work.

hth
Bastien

There are many ways to skin this cat,
but it still tastes like chicken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top