asp下拉菜单的值怎么提交,怎么获取?
提交页面是:<formname="form1"action="czss1.asp"method="post"enctype="multipart/form-data"ta...
提交页面是:
<form name="form1" action="czss1.asp" method="post" enctype="multipart/form-data" target="_new">
<p>
<select name="deptname" id="deptname">
<option value="科室名称">请选择科室名称</option>
<option value="jzk">急诊科</option>
<option value="zzjh">重症监护(ICU)</option>
<option value="xxwk">心胸外科</option>
<option value="mnwk">泌尿外科</option>
<option value="神经外科">神经外科</option>
<option value="骨科三病区">骨科三病区</option>
<option value="骨科四病区">骨科四病区</option>
<option>产科</option>
<option>妇科</option>
<option>儿科</option>
<option>心血管内科</option>
<option>普通外科</option>
<option>眼科</option>
<option>耳鼻喉科</option>
<option>口腔科</option>
<option>神经内科一区</option>
<option>神经内科二区</option>
<option>血液消化内分泌科</option>
<option>中医中西医科</option>
<option>呼吸肾脏风湿免疫科</option>
<option>康复科</option>
<option>保健科</option>
<option>肿瘤科</option>
<option>烧伤整形科</option>
</select>
</p>
<p>
<input name="docname" type="text" size="15">
<input type="Submit" name="Submit" value="查询" onClick="return validate()">
</p>
<input name="doctime" type="text" size="15">
</p>
</form>
获取页面是:
<%
Dim db,strconn,i,j,k,strsql,rs
set db=server.createobject("adodb.connection")
strconn="provider=sqloledb;data source=(local);initial catalog=ERDOSZXYY;uid=sa;pwd=admin;"
db.open strconn
i=""
j=""
k=""
i=request.form("docname")
j=request.form("doctime")
k=request.form("deptname")
strsql=""
if i<>"" and j="" then
strsql="select * from doctor where dept like '%"&k&"%' and doctor_name like '%"&i&"%'"
elseif j<>"" and i="" then
strsql="select * from doctor where dept like '%"&k&"%' and out_date like '%"&j&"%'"
else
strsql="select * from doctor where dept like '%"&k&"%' and doctor_name like '%"&i&"%' and out_date like '%"&j&"%'"
end if
response.write(strsql)
set rs=server.CreateObject("adodb.recordset")
rs.open strsql,db,3,2
这样获取以后,sql语句总是:select * from doctor where dept like '%%' and doctor_name like '%%' and out_date like '%%' ,而不随提交值的变化而变化,请问是提交过程,还是条件语句出问题了?非常感谢!!! 展开
<form name="form1" action="czss1.asp" method="post" enctype="multipart/form-data" target="_new">
<p>
<select name="deptname" id="deptname">
<option value="科室名称">请选择科室名称</option>
<option value="jzk">急诊科</option>
<option value="zzjh">重症监护(ICU)</option>
<option value="xxwk">心胸外科</option>
<option value="mnwk">泌尿外科</option>
<option value="神经外科">神经外科</option>
<option value="骨科三病区">骨科三病区</option>
<option value="骨科四病区">骨科四病区</option>
<option>产科</option>
<option>妇科</option>
<option>儿科</option>
<option>心血管内科</option>
<option>普通外科</option>
<option>眼科</option>
<option>耳鼻喉科</option>
<option>口腔科</option>
<option>神经内科一区</option>
<option>神经内科二区</option>
<option>血液消化内分泌科</option>
<option>中医中西医科</option>
<option>呼吸肾脏风湿免疫科</option>
<option>康复科</option>
<option>保健科</option>
<option>肿瘤科</option>
<option>烧伤整形科</option>
</select>
</p>
<p>
<input name="docname" type="text" size="15">
<input type="Submit" name="Submit" value="查询" onClick="return validate()">
</p>
<input name="doctime" type="text" size="15">
</p>
</form>
获取页面是:
<%
Dim db,strconn,i,j,k,strsql,rs
set db=server.createobject("adodb.connection")
strconn="provider=sqloledb;data source=(local);initial catalog=ERDOSZXYY;uid=sa;pwd=admin;"
db.open strconn
i=""
j=""
k=""
i=request.form("docname")
j=request.form("doctime")
k=request.form("deptname")
strsql=""
if i<>"" and j="" then
strsql="select * from doctor where dept like '%"&k&"%' and doctor_name like '%"&i&"%'"
elseif j<>"" and i="" then
strsql="select * from doctor where dept like '%"&k&"%' and out_date like '%"&j&"%'"
else
strsql="select * from doctor where dept like '%"&k&"%' and doctor_name like '%"&i&"%' and out_date like '%"&j&"%'"
end if
response.write(strsql)
set rs=server.CreateObject("adodb.recordset")
rs.open strsql,db,3,2
这样获取以后,sql语句总是:select * from doctor where dept like '%%' and doctor_name like '%%' and out_date like '%%' ,而不随提交值的变化而变化,请问是提交过程,还是条件语句出问题了?非常感谢!!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询