求助一个简单的问题。就是关于下拉列表内容添加到数据库字段。
<!--#includefile="conn.asp"--><!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN...
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>TEST</title>
</head>
<body>
<form name="test" action="?a=a" >
<select name="jibie" id="jibie">
<option value= "1" selected="selected">普通会员</option>
<option value = "2">贵宾会员</option>
<option value = "3">商务会员</option>
<option value = "4">至尊会员</option>
</select>
<input type="submit" name="tj" value="添加会员级别"/>
</form>
<%
if request.querystring("a")="a" then
jibie = request.form("jibie")
set rs=server.CreateObject("adodb.recordset")
sql ="select * from jibie"
rs.open sql,conn,2,2
rs.addnew
rs("jibie") = jibie
rs.update
rs.close
set rs = nothing
end if
%>
</body>
</html>
这样为什么不能把数据提交到数据表里面?应该怎样写?
原来是少了这句话。。。method="post" 展开
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>TEST</title>
</head>
<body>
<form name="test" action="?a=a" >
<select name="jibie" id="jibie">
<option value= "1" selected="selected">普通会员</option>
<option value = "2">贵宾会员</option>
<option value = "3">商务会员</option>
<option value = "4">至尊会员</option>
</select>
<input type="submit" name="tj" value="添加会员级别"/>
</form>
<%
if request.querystring("a")="a" then
jibie = request.form("jibie")
set rs=server.CreateObject("adodb.recordset")
sql ="select * from jibie"
rs.open sql,conn,2,2
rs.addnew
rs("jibie") = jibie
rs.update
rs.close
set rs = nothing
end if
%>
</body>
</html>
这样为什么不能把数据提交到数据表里面?应该怎样写?
原来是少了这句话。。。method="post" 展开
1个回答
展开全部
option value= "1"液迅拆 selected="selected">普通会员</option>
<option value = "2">贵宾会员</option>
<option value = "3">商务会员</option>
<option value = "4">至尊会员</option>
你的这个下拉列表的值是value是1,2,3,4
<option value= "普通会员" selected="selected">普通会员</option>
<option value = "普通会员">普通会员</option>
<option value = "普通会员"闹枣>普通会员</option>
<option value = "普昌散通会员">普通会员</option>
还有这里rs("jibie") = jibie
应该写rs("jibie") =request.form("jibie")
<option value = "2">贵宾会员</option>
<option value = "3">商务会员</option>
<option value = "4">至尊会员</option>
你的这个下拉列表的值是value是1,2,3,4
<option value= "普通会员" selected="selected">普通会员</option>
<option value = "普通会员">普通会员</option>
<option value = "普通会员"闹枣>普通会员</option>
<option value = "普昌散通会员">普通会员</option>
还有这里rs("jibie") = jibie
应该写rs("jibie") =request.form("jibie")
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询