瓦屋山木头别墅:动态下拉菜单

来源:百度文库 编辑:高考问答 时间:2024/06/30 19:07:39
显示class ,把值为classid提交到数据库中
我的classid有很多,不知道怎么可以显示全部,如果用movenext显示出来的根本不是下拉菜单
请高手根据我的代码改一下,该如何实现,谢谢
<!--#include file="conn.asp"-->
<%
set rs_class =server.CreateObject("ADODB.recordset")
rs_class.open "select * from class",conn,1,1
%>
<select name="productid" id="productid">
<option value="<%=rs_class("classid")%>"><%=rs_class("class")%></option>
</select>

<select name="productid" id="productid">
<%
while not rs_class.eof
%>
<option value="<%=rs_class("classid")%>"><%=rs_class("class")%></option>
<%
rs_class.movenext
wend
%>
</select>

<!--#include file="conn.asp"-->
<%
set rs_class =server.CreateObject("ADODB.recordset")
rs_class.open "select * from class",conn,1,1
%>
<select name="productid" id="productid"> <% for a=1 to rs_class.recordcount %>
<option value="<%=rs_class("classid")%>"><%=rs_class("class")%></option> <% rs_class.movenext
if rs_class.eof then
rs_class.movelast
end if
next %>
</select>

<!--#include file="conn.asp"-->
<%
set rs_class =server.CreateObject("ADODB.recordset")
rs_class.open "select * from class",conn,1,1
%>
<select name="productid" id="productid">
<%
do while not rs_class.eof
%>
<option value="<%=rs_class("classid")%>"><%=rs_class("class")%></option>
<%
rs_class.movenext
loop
rs_class.end
%>
</select>

movenext是要用循环的,而且你的select * from class是二维数组对象吗

多谢几个 option