asp里条件语句的困惑

来源:百度知道 编辑:UC知道 时间:2024/06/06 20:38:50
<%@language=vbscript%>
<!--#include file="conn.asp"-->
<%
if session("adminlogin")="" then
Response.Redirect "index.asp"
else

webname=request("webname")
weburl=request("weburl")
webinfo=request("webinfo")
keyword=request("keyword")
tel=request("tel")
mobile=request("mobile")
qq=request("qq")
email=request("email")
webadmin=request("webadmin")
style=request("style")

conn.execute("update utopia_Config set webname='"&webname&"'")
conn.execute("update utopia_Config set weburl='"&weburl&"'")
conn.execute("update utopia_Config set webinfo='"&webinfo&"'")
conn.execute("update utopia_Config set keyword='"&keyword&"'")

在 else 前面加一句

response.end

如下:

<%
if session("adminlogin")="" then
Response.Redirect "index.asp"
response.end
else

你else后面没有{}括号吧。。。
要把else后面所有代码全{}起来。

如果我想让非法提交的时候不更新数据,并且返回index.asp这个页面我该怎么做?

可以到else后面就是
webname=request("webname") 加个判断。
if(webname=="")
{
Response.Redirect "index.asp"
}
类似这种的你可以自己设计个判断,也返回一个出错页面。