提交表单的程序错在哪儿了?
页面表单的程序index.asp
-------------------
- HTML code
<FORM name=testform action="sendmail_wsdg.asp" method=post> <tbody> <tr> <td height=471 bgcolor="#FFFFCC"><font color=#ff0000> </font> <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height=28><div align="center">在线订购</div></td> </tr> </table> <table width="92%" height="32" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td> <div align="left"><font color=#ff0000> *</font>姓 名: <input name=a1 class="4" size=16></div></td> </tr> </table> <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height=38><div align="left"><font color=#ff0000> </font> 性 别: <select name=a2 class="4" size=1> <option value=男 selected><font face="宋体">男</font></option> <option value=女><font face="宋体">女</font></option> </select></div></td> </tr> </table> <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height=38><div align="left"><font color=#ff0000></font><font color=#ff3333> *</font>座 机: <input name=a3 class="4" size=13> 手 机: <input name=a4 class="4" size=22> </div></td> </tr> </table> <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height=38><div align="left"><font color=#ff0000> </font><font color=#ff3333>*</font>送货地址及邮编: <input name=a5 class="4" size=38> </div></td> </tr> </table> <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height=38><div align="left"><font color=#ff0000> </font><font color=#ff3333>*</font>产品选择: <select name=a6 size=1 class="4" style="width:90" select> <option value=" 000">000</option> <option value="111">111</option> <option value="222">222</option> </select></div></td> </tr> </table> <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height=38><div align="left"><font color=#ff0000> </font><font color=#ff3333>*</font>付款方式: <input type="radio" checked name="a7"> 货到付款 <input type="radio">款到发货 </div></td> </tr> </table> <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height=63 align="center" valign="middle"> <div align="left" vlign="center"> 备注提醒: <textarea cols="50" rows="3" name="a8"></textarea> </div> </td> </tr> </table> <table width="92%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height=36 valign="middle"><div align="left"><font color=#ff0000> </font> <input name=B1 type=submit class="4" value="发 送"> <input name=B2 type=reset class="4" value="清 除"> </div></td> </tr> </table> </td> </tr> </tbody> </form>
连接数据库的程序connection_wsdg.asp
-------------------
<%
dim conn
dim connstr
connstr="DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("data/wsdg.mdb")
set conn=Server.Createobject("Adodb.Connection")
conn.CommandTimeout =30
conn.ConnectionTimeout =30
conn.open connstr
%>
接收数据的程序sendmail_wsdg.asp
-------------------
<!--#include file="connection_wsdg.asp"-->
<%
Function SqlStr(varTemp)
varTemp=Replace(varTemp,"<","<")
varTemp=Replace(varTemp,">",">")
sqlstr=vartemp
End Function
dim a1,a2,a3,a4,a5,a6,a7,a8,wtime
a1=sqlstr(request("a1"))
a2=sqlstr(request("a2"))
a3=sqlstr(request("a3"))
a4=sqlstr(request("a4"))
a5=sqlstr(request("a5"))
a6=sqlstr(request("a6"))
a7=sqlstr(request("a7"))
a8=sqlstr(request("a8"))
set rs=server.createobject("adodb.recordset")
sql="select * from consumer"
rs.open sql,conn,3,3
rs.addnew
rs("a1")=a1
rs("a2")=a2
rs("a3")=a3
rs("a4")=a4
rs("a5")=a5
rs("a6")=a6
rs("a7")=a7
rs("a8")=a8
rs("wtime")=date()
rs.update
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
access数据库wsdg.mdb,建立一个表格consumer
字段名称 数据类型
a1 文本
a2 文本
a3 文本
a4 文本
a5 文本
a6 文本
a7 文本
a8 备注
wtime 日期/时间
[解决办法]
这个有些难找。一行一行删除排除吧。或加上on error resume next
[解决办法]
分步骤调试一下。print
[解决办法]
那是你的JS验证没有检测到,导致你在不允许为空的位置存入空值,检测下你的JS,或者在数据为空时设置一个默认值。