Hello,
I have the following code - a drop-down list populated from DB. It submits the form to the same page. I want to have the drop-down menu write in select="selected" for the item that was chosen, but i can not get this to work! Can anyone see why this may be?
thanks in advance for having a look.
I have the following code - a drop-down list populated from DB. It submits the form to the same page. I want to have the drop-down menu write in select="selected" for the item that was chosen, but i can not get this to work! Can anyone see why this may be?
Code:
<form name="stats" method="post" action="voteadmin.asp?content=2">
<font class="contentred"> Choose Poll:</font>
<%
set conn = server.createobject("adodb.connection")
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("../../employeesurvey/vote/polls.mdb")
set objRS = server.createobject("adodb.recordset")
strsql = "SELECT * FROM Questions"
objRS.open strsql, conn, 2, 2
dim tur
tur = Request.Form("stat")
'response.write tur
%>
<select name="stat" class="inputbox" onChange="this.form.submit();">
<%
Do While Not objRS.EOF
%>
<option value="<%=objRS("ID")%>"
<%
if objRs("ID") = tur then
response.write("select=""selected""")
end if
%>
>
<%=objRS("question")%>
</option>
<%objRS.movenext%><% loop %>
</select>
<input type="hidden" name="showresults" value="45" />
</form>
thanks in advance for having a look.