刚刚手写代码完了,可是出现了一个莫名其妙的问题…………
明明 我表单文本字段提交的有东西,可是页面老是出现错误“*****不能为空”,删掉前一个,后一个又出现…………
哎…………
这些G_title等在表单中对应名称都是一样的,连大小写都没有问题,可真是弄不明白…………
但是把以下验证去掉提交到数据库中还真的没有任何内容,真是不明白之至啊…………
不过此文件是被另外文件<!-include -->起来的,莫非与此有关,但是也不至于啊…………
<%'===========================验证表单内容是否合法(开始)===============================================
G_title=replace(trim(request.form("G_title")),"'","")
G_code=replace(trim(request.form("G_code")),"'","")
G_orderQ=replace(trim(request.form("G_orderQ")),"'","")
G_user=replace(trim(request.form("G_user")),"'","")
G_mob=replace(trim(request.form("G_mob")),"'","")
G_tel=replace(trim(request.form("G_tel")),"'","")
G_giftid=replace(trim(request.form("G_giftid")),"'","")
G_add=replace(trim(request.form("G_add")),"'","")
G_mail=replace(trim(request.form("G_mail")),"'","")
if G_title="" then
response.write "<SCRIPT language=JavaScript>alert('礼品名称不能为空');"
Response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
Response.End
end if
if G_code="" then
response.write "<SCRIPT language=JavaScript>alert('产品编号不能为空');"
Response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
Response.End
end if
if G_orderQ="" then
response.write "<SCRIPT language=JavaScript>alert('礼品数量不能为空');"
Response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
Response.End
end if
if G_user="" then
response.write "<SCRIPT language=JavaScript>alert('预订者姓名不能为空');"
Response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
Response.End
end if
if G_mob="" or G_giftid="" or G_mail="" or G_add="" or G_tel="" then
response.write "<SCRIPT language=JavaScript>alert('请确认您已经完全填写了表格中加了*号的项目,返回检查重新填写。');"
Response.Write"this.location.href='vbscript:history.back()';</SCRIPT>"
Response.End
end if
'=====================%>
[此贴子已经被作者于2006-9-1 10:33:47编辑过]