form表单提交数据时无法调用vbscript过程!

chenhuiran 2007-08-20 09:47:38

一个简单的程序,但是不知道为什么form表单提交数据时无法调用vbscript过程!(action写明详细的url地址也无法调用!)思考了一段时间也没有理出头绪,请高手帮忙看一下,非常感谢!

源代码如下


<body>
<form id="form1" name="form1" action="" method="post">
<input name="title" type="text" value="1"></input>
<input name="context" type="text" value="2"></input>
<input name="submit" type="submit"/><input name="reset" type="reset"/>
</form>

<%
sub add()
dim title,content

''定义变量

title =Trim(Request.Form("title"))

content=Trim(Request.Form("content"))

response.Write"变量定义好了"

''获取表格的数据

if title = "" or content ="" then

Response.Write "<script>alert(""请填写内容!"");location.href=""javascript:history.go(-1)"";</script>"

response.end()

end if

''当所填写内容为空时返回!

sql="select * from KD_OrderForm "

''SQL语句

set rs= Server.CreateObject("adodb.recordset")

''定义数据集

rs.open sql,cn,1,3

''打开数据

''添加开始

rs.addnew

rs("OrderForm_Outgo")=title

rs("OrderForm_Type")=content

rs.update

''添加结束

rs.close

set rs=nothing

''关闭数据集

cn.close

set cn=nothing

''关闭连接

response.write "<script>alert(''系统提示:\n\n ■ 添加成功!''); location.href(''edit.asp'');</script>"

response.end()
end sub

%>

</body>
</html>
...全文
194 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
chenhuiran 2007-08-20
  • 打赏
  • 举报
回复
谢谢!
茅塞顿开!
什么都不能 2007-08-20
  • 打赏
  • 举报
回复
没有写调用sub的代码,只看到定义没有看到调用
chenhuiran 2007-08-20
  • 打赏
  • 举报
回复
谢谢!
action写清楚要提交的网页地址也不行。ie地址栏里显示 http://localhost/xxx(此处是虚拟目录)/Test.asp?action=add。应该是调用了vbscript过程,但是无法执行ASP代码!去掉过程定义后,ASP代码会执行!本人愚笨,找不出头绪,请大家指点一下。谢谢。
jingxiaoping 2007-08-20
  • 打赏
  • 举报
回复
<form id="form1" name="form1" action="" method="post">
<input name="title" type="text" value="1"></input>
<input name="context" type="text" value="2"></input>
<input name="submit" type="submit"/><input name="reset" type="reset"/>
</form>
action=""换成action="你要提交的页面地址"

28,405

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧