asp+access中,如何将下拉列表中的值写入数据库
<selectname="cd"id="cd"><optionvalue="省份">省份</option><optionvalue="广州">广州</option><op...
<select name="cd" id="cd">
<option value="省份">省份</option>
<option value="广州">广州</option>
<option value="猪头">猪头</option>
</select>
<%
If request.form("CompanyName")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入公司名称,请返回检查!!"");history.go(-1);</script>")
response.end
end if
If request.form("Receiver")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入联系人,请返回检查!!"");history.go(-1);</script>")
response.end
end if
If request.form("Phone")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入联系电话,请返回检查!!"");history.go(-1);</script>")
response.end
end if
Add=trim(request.form("Add"))
Postcode=trim(request.form("Postcode"))
Mobile=trim(request.form("Mobile"))
Fax=trim(request.form("Fax"))
email=trim(request.form("email"))
if Add="" then
Add=null
end if
if Postcode="" then
Postcode=null
end if
if Mobile="" then
Mobile=null
end if
if Fax="" then
Fax=null
end if
if Email="" then
Email=null
end if
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Feedback"
rs.open sql,conn,1,3
rs.addnew
if session("username")="" then
rs("Username")="未注册用户"
else
rs("Username")=trim(request.form("Username"))
end if
rs("CompanyName")=trim(request.form("CompanyName"))
rs("Add")=Add
rs("Postcode")=Postcode
rs("Receiver")=trim(request.form("Receiver"))
rs("Phone")=trim(request.form("Phone"))
rs("Mobile")=Mobile
rs("Fax")=Fax
rs("email")=email
rs("title")=trim(request.form("title"))
rs("content")=htmlencode2(request.form("content"))
rs("Publish")=trim(request.form("Publish"))
rs("time")=date()
rs.update
rs.close
response.redirect "FeedbackView.asp"
%>
还有数据库应该怎么做| 展开
<option value="省份">省份</option>
<option value="广州">广州</option>
<option value="猪头">猪头</option>
</select>
<%
If request.form("CompanyName")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入公司名称,请返回检查!!"");history.go(-1);</script>")
response.end
end if
If request.form("Receiver")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入联系人,请返回检查!!"");history.go(-1);</script>")
response.end
end if
If request.form("Phone")="" Then
Response.Write("<script language=""JavaScript"">alert(""错误:您没输入联系电话,请返回检查!!"");history.go(-1);</script>")
response.end
end if
Add=trim(request.form("Add"))
Postcode=trim(request.form("Postcode"))
Mobile=trim(request.form("Mobile"))
Fax=trim(request.form("Fax"))
email=trim(request.form("email"))
if Add="" then
Add=null
end if
if Postcode="" then
Postcode=null
end if
if Mobile="" then
Mobile=null
end if
if Fax="" then
Fax=null
end if
if Email="" then
Email=null
end if
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Feedback"
rs.open sql,conn,1,3
rs.addnew
if session("username")="" then
rs("Username")="未注册用户"
else
rs("Username")=trim(request.form("Username"))
end if
rs("CompanyName")=trim(request.form("CompanyName"))
rs("Add")=Add
rs("Postcode")=Postcode
rs("Receiver")=trim(request.form("Receiver"))
rs("Phone")=trim(request.form("Phone"))
rs("Mobile")=Mobile
rs("Fax")=Fax
rs("email")=email
rs("title")=trim(request.form("title"))
rs("content")=htmlencode2(request.form("content"))
rs("Publish")=trim(request.form("Publish"))
rs("time")=date()
rs.update
rs.close
response.redirect "FeedbackView.asp"
%>
还有数据库应该怎么做| 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询