Dynamic Drop Down Search
Posted on 2004-11-02
Totally easy question, yet I can't seem to find any reliable code that will make it work.
Essentially, I want to have a drop down box populated dynamically from my DB. I have that code:
<select name="type" onchange="location.href='author.asp?type=' + this.options[this.selectedIndex].value;">
<option value="">--Select author--</option>
sql = "SELECT distinct author from newreviews order by author asc"
'sql = "SELECT reviewid from newreviews"
set typers = conn.execute(sql)
do while not typers.eof
response.write("<option value=""" & Server.urlencode(typers("author")) & """><B>" &typers("author")&"</b></option> ")
set typers = nothing
Though the Server.URLencode seems to be giving me an error.
Does anyone have any generic code that will make this work? All I want to do is have a drop down list with a "Submit" button that will return all of the author's reviews (titles) once clicked. and I'm stumped.