小妹求教 asp 分类搜索的问题!

来源:百度知道 编辑:UC知道 时间:2024/04/30 07:33:22
小妹刚学asp不久,最近碰到了一个问题,求你们帮忙了。
是关于产品分类搜索的代码,表单代码如下:
<form action="products.asp" method="post" name="form1" id="form1">
<tr>
<td height="60"><div align="center">
<input style="BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; BORDER-LEFT: #cccccc 1px solid; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 16px" size="22" name="KeyWord" />
</div></td></tr>
<tr>
<td height="30">
<div align="center">
<select name="classid" id="classid" style="background-color: rgb();font-size: 9pt;border:1px double rgb(255,255,255);width:140px;height:14px" >
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from products_class where classid<>0 "&sqlwhere&" order by class

接收的products.asp页面代码中
sclassid=request("sclassid")这句话接受不到你想要提交的东西,因为在第一个页面中你没有sclassid项,你本来想得到主目录下的复目录的东西,但在实际中,你把复目录sclassid放到了classid一块,是分辨不出来的,
你把前面的
<option value="<%=nrs("sclassid")%>"> |--<%=nrs("classname")%></option> 语句改成
<option value="=<%=nrs("sclassid")%>"> |--<%=nrs("classname")%></option>
然后把products.asp做部分修改

先把

dim sclassid 和
sclassid=request("sclassid")

删除,然后把

if classid<>"" then sqlwhere=sqlwhere &" and classid="&classid&""
if sclassid<>"" then sqlwhere=sqlwhere &" and sclassid="&sclassid&""

这两句话改成

if left(classid,1)<>"=" and classid<>"" then sqlwhere=sqlwhere &" and classid="&classid&""
if left(classid,1)="