下面是两个下拉列表,从两个下拉列表中取值
form name="form1" action="result.asp">
<p>
<select name="mainmenu" size="1" onchange=location.href='result.asp?field='+this.value>
<option value=0>请选择……</option>
<%while not rs1.eof%>
<option value="<%=rs1("产品型号")%>"><%=rs1("产品型号")%></option>
<%rs1.movenext
wend%>
</select>
<select name="sel" class="STYLEME" id="sel">
<option value="车架" selected="selected">车架</option>
<option value="变速箱">变速箱</option>
<option value="引擎">引擎</option>
</select>
</p>
</p>
<p>
<label>
<input type="submit" name="Submit" value="提交" />
完成查询,输出结果
<%
dim rs
dim sql
dim Conn
dim typ
dim aa
ConnStr="driver={sql server};server=127.0.0.1;database=tire;uid=sa;pwd=111111"
set Conn=server.createobject("adodb.connection")
Conn.Open ConnStr
Set rs=Server.CreateObject("ADODB.Recordset")
aa=request.QueryString("field")
response.Write(aa)
typ=request.QueryString("sel")
response.Write(typ)
sql="select * from lingbujian where 车型='"& aa &"' and 零部件名称='"& typ &"'"
rs.Open sql,Conn,1,1
if rs.EOF or rs.BOF then
Response.Write("<hr>数据库中暂无资料!")
Else
do while not rs.EOF or rs.BOF
但是,我的这两个变量不能同时获取下拉列表的值,不知道为什么,是因为在第一个菜单时就跳转了吗?!
------解决方案--------------------------------------------------------
typ=request.QueryString("sel")
改为
typ=request.form("sel")
------解决方案--------------------------------------------------------
onchange=location.href='result.asp?field='+this.value +'&sel=' + document.all.sel.value