ASP 下拉列表框写入两个字段数据怎么写?
发布网友
发布时间:2022-08-20 04:06
我来回答
共6个回答
热心网友
时间:2023-10-31 02:10
<!--#include file="conn.asp"-->
<form name=form1 method="post" action="">
<select name="grade">
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
</select>
<select name="spec">
<option value="01">酒管</option>
<option value="02">旅管</option>
<option value="03">导游</option>
</select>
<select name="eSys">
<option value="01">本科</option>
<option value="02">大专</option>
<option value="03">中专</option>
</select>
<select name="classes">
<option value="01">一班</option>
<option value="02">二班</option>
<option value="03">三班</option>
</select>
<input type="hidden" name="f" value="f" />
<input type="submit" name="Submit" value="提交" />
</form>
<%
if request.form("f")="f" then
dim grade,spec,eSys,classes,specNo,eSysNo,classesNo
grade=request.form("grade")
specNo=request.form("spec")
eSysNo=request.form("eSys")
classesNo=request.form("classes")
select case specNo
case "01":spec="酒管"
case "02":spec="旅管"
case "03":spec="导游"
end select
select case eSysNo
case "01":eSys="本科"
case "02":eSys="大专"
case "03":eSys="中专"
end select
select case classesNo
case "01":classes="一班"
case "02":classes="二班"
case "03":classes="三班"
end select
conn.execute("insert into class (classid,className) values ('"&grade&specNo&eSysNo&classesNO&"','"&grade&spec&eSys&classes&"')")
response.write("<script>alert('添加成功')</script>")
end if
%>
热心网友
时间:2023-10-31 02:10
<select id="s1">
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
</select>
<select id="s2>
<option value="01">酒管</option>
<option value="02">旅管</option>
<option value="03">导游</option>
</select>
<select id="s3">
<option value="01">本科</option>
<option value="02">大专</option>
<option value="03">中专</option>
</select>
<select id="s4">
<option value="01">一班</option>
<option value="02">二班</option>
<option value="03">三班</option>
</select>
sql="insert class (classname,classid) values ('" & s1.value & s2.value & s3.value & s4.value & "','" & s1.innerText & s2.innerText & s3.innerText & s4.innerText & "')"
热心网友
时间:2023-10-31 02:11
lazy67大侠
不行啊。我现在用的是下面的代码,只能添加到一个字段。
<%
Dim schoolname,schoolmaster,schooladress,schooltel,schooladmin,schoolpwd
schoolname=Trim(Request.Form("xueji")&Request.Form("zhuanye")&Request.Form("xue")&Request.Form("banji"))
热心网友
时间:2023-10-31 02:11
在提交表单的时候写一段分析语句,将数字还原成文本,然后通过代码将文本写入数据库相应的字段
热心网友
时间:2023-10-31 02:12
<%
Dim schoolname,schoolmaster,schooladress,schooltel,schooladmin,schoolpwd
schoolname=Trim(Request.Form("xueji")&Request.Form("zhuanye")&Request.Form("xue")&Request.Form("banji"))
'在你的项目标签不是从数据库取出可用此法
select case zhuanye
case 01
zhuanye1="酒管"
case 02
zhuanye1="旅管"
case 03
zhuanye1="导游"
case else
zhuanye1="酒管"
end select
'其他类型............
schoolx=Trim(Request.Form("xueji")&zhuanye1&xue1&banji1
%>
热心网友
时间:2023-10-31 02:13
你不怕麻烦就用隐藏域,试试
<input type="hidden" name="酒管" value="01">
<input type="hidden" name="旅管" value="02">
<input type="hidden" name="导游" value="03">
<select name="ZhuanYe">
<option value="酒管">酒管</option>
<option value="旅管">旅管</option>
<option value="导游">导游</option>
</select>
<%
dim ZhuanYe = request("ZhuanYe")
dim ZhuanYeId = request(ZhuanYe)
%>
我没试,只是给你提供一个思路
或则你改数据库好了
为什么下拉要写死呢?
为什么不把学籍,专业,学制做成数据库里的基础字段表呢?