if语句,老是出错,快疯了.

来源:百度知道 编辑:UC知道 时间:2024/05/22 11:46:11
if method="post" then
(if uid="" or pwd="" then
response.write("<script language='javascript'>alert('认真');this.location='useradd.html';</script>")
else
sql="insert into id_pad(uid,pwd,n_type) values('"& uid &"','"& pwd &"',0)"
conn.execute sql
response.write("<script language='javascript'>alert('操作成功');this.location='login.html';</script>")
end if)
end if
if method="get" then
(if puid="" then
response.write("<script language='javascript'>alert('细心');this.location='useradd.html';</script>")
else
sql="update id_pad set n_type='1' where uid='"&puid&"'"
response.Write sql
end if)

错哪.?
if 条件1 then

用elseif 注意要连起来 另外用缩进表示逻辑 这样自己不容易漏掉end
<%
if method="post" then
if uid="" or pwd="" then
response.write("<script language='javascript'>alert('认真');this.location='useradd.html';</script>")
else
sql="insert into id_pad(uid,pwd,n_type) values('"& uid &"','"& pwd &"',0)"
conn.execute sql
response.write("<script language='javascript'>alert('操作成功');this.location='login.html';</script>")
end if
elseif method="get" then
if puid="" then
response.write("<script language='javascript'>alert('细心');this.location='useradd.html';</script>")
else
sql="update id_pad set n_type='1' where uid='"&puid&"'"
response.Write sql
e