Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - combobox filled with database data
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

combobox filled with database data

 Post Reply Post Reply
Author
t.vdplaats View Drop Down
Newbie
Newbie


Joined: 02 April 2005
Location: Netherlands
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote t.vdplaats Quote  Post ReplyReply Direct Link To This Post Topic: combobox filled with database data
    Posted: 02 April 2005 at 7:06am
Can anybody tell me how I can fill a combobox with database dat??
 
I have a combobox with these settings:
 
 <form name="framecombo">
        <div align="center"><br>
<select name="framecombo2" size=1 class="menunormal">
<option value="link.asp?NewsID=34" selected>Selecteer...</option>
<option value="link.asp?NewsID=42">Acne</option>
<option value="link.asp?NewsID=52">Couperose</option>
<input type="button" value="Zoek aandoening" onClick="jumpbox()" class="menunormal">
 
      <div align="left">
        <script language="javascript">
<!--
//set below variable to "1" to open combo in another frame, "2" to open in full window (parent window)
var openmode=1
//if above set to 1, specify the name of the frame you wish the combo to load in below
var targetframe="vlak"
function jumpbox(){
var destination=eval("window.parent."+targetframe)
var thebox=document.framecombo
if (openmode==2)
destination=window.parent
destination.location=
thebox.framecombo2.options[thebox.framecombo2.selectedIndex].value
}
//-->
</script>
 
The list is about 60 items long which I have to update manually... :-(
 
I'd like to get the listing from de database and the title as the option...
 
Can anybody tell me how to do this??
 
Thanx!
 
Taco
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 04 April 2005 at 12:58am
set vrec = server.createobject("ADODB.Recordset")
set adoCon = server.CreateObject("ADODB.Connection")
 
...
 
<select name="framecombo2" size=1 class="menunormal">
<%
sql = "SELECT optionvalue, optionname FROM tablename"
vrec.open sql, adoCon
Do Until vrec.eof
%>
<option name="framecombo2" value="<%= vrec("optionvalue")%>"><%=vrec("optionname")%></option>
<%
loop
%>
</select>


Edited by ub3rl337ch3ch - 04 April 2005 at 1:00am
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.