ASP表单提交问题

ASP表单提交问题,第1张

分类: 电脑/网络 >>程序设计 >>其他编程语言

问题描述:

[url=zhidao.baidu/question/yitong-jiesuan]我写了一个表单提交 但是提交的时候提示类型不匹配 不知道为什么

我的代码斗滑如下

<!--#include file="conn"-->

<%

name=Request.Form("name")

yh=Request.Form("yh")

haoma=Request.Form("haoma")

*** =Request.Form(" *** ")

jssj=Request.Form("jssj")

ip=Request.Form("ip")

qian=Request.Form("ip")*0.005

shijian=Request.Form("shijian")

if ip="" then

response.write"<script language=JavaScript>{window.alert('对不起,当日IP不能为空,请返回重新填写')window.location.href='yitong-jiesuan'}</script>"

response.End()

end if

sql="insert into jiesuan(name,yh,haoma, *** ,jssj,ip,qian) values('"+name+"'空逗腊,'"+yh+"','"+haoma+"','"+ *** +"','"+jssj+"','"+ip+"','"+qian+"')"

set savejiesuan=conn.execute(sql)

response.write"<script language=JavaScript>{window.alert('成功结算!')window.location.href='yitong-jiesuanlist'}</script>"

response.End()

savejiesuan.close

set savejiesuan=nothing

conn.close

set conn=nothing

%>

其中的ip在数据库里是数字型的qian也是数字型的 在这里qian是又ip*0.005得来的 可是就是提示类型不匹配 请各位高手帮~!

解析:

[/url]错在:

sql="insert into jiesuan(name,yh,haoma, *** ,jssj,ip,qian) values('指升"+name+"','"+yh+"','"+haoma+"','"+ *** +"','"+jssj+"','"+ip+"','"+qian+"')"

既然IP和qian是数据型的,那么

sql="insert into jiesuan(name,yh,haoma, *** ,jssj,ip,qian) values('"+name+"','"+yh+"','"+haoma+"','"+ *** +"','"+jssj+"',"+ip+","+qian+")"

数字型的不要在值上打双引号

更何况,你用的好像是VBSCRIPT脚本,不应该用"+"来连接字符

正确的应该是:

sql="insert into jiesuan(name,yh,haoma, *** ,jssj,ip,qian) values('"&name&"','"&yh&"','"&haoma&"','"&*** &"','"&jssj&"',"&ip&","&qian&")"

你的提交位于 action=test.asp 的提交表单握液中,拆皮蠢当然是提交到test.asp了。

因为页面有2个form,你可以分别设置个name

<form action="upLoad.asp" method="post" enctype="multipart/form-data" name="FORM1">

<form action="test.asp" method="post" name="form2">旅陪

然后 提交 按钮 中插入代码

<input type="button" name="Submit" onClick="form2.submit()" value="提交">

希望能够帮助你


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12239500.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-22
下一篇 2023-05-22

发表评论

登录后才能评论

评论列表(0条)

保存