2016lpl全明星:ASP问题,谢谢各位!

来源:百度文库 编辑:神马品牌网 时间:2024/05/06 16:42:14
我想在同一个文件里设置表单,然后提交之后也在本文件里查询数据库进行判断该怎么写?
比如,在zhece.asp中接值后,提交触发表单的action="zheche.asp"
但是这样写不行,应该怎么写,请高手指教!
上面写错了一点,两个文件都是zhuce.asp

例子:把form和验证代码分别放在if 的then里面和else后面
if {参数判断}then{验证代码}else{form}end if
这样通过参数的有无将一个文件当两个文件用
'new_dl.asp
<!--#include file="conn.asp"-->
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<title>登陆</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head>
<body>
<table width="778" border="0" cellspacing="0" cellpadding="0" background="images/top-back.gif" align="center">
<tr>
<td height="74" align="center" width="190"><img src="images/logo.gif" width="78" height="74"></td>
<td align="center" height="74"><font color="#E3E9F1" size="6" face="华文行楷"><%=bb%></font></td>
</tr>
</table>
<table width="778" border="1" cellspacing="0" cellpadding="0" bgcolor="#7894AF" align="center">
<tr bgcolor="#eeeeee">
<td height="25" ><%=why%>   欢迎来到 <%=bb%>!</td>
</tr>
</table>
<p>
<%yhm=request.form("yhm")
pass=request.form("pass")
if yhm<>"" and pass<>"" then
set rs=server.createobject("adodb.recordset")
exec="select * from admin where yhm='"+yhm+"'"
rs.open exec,conn,1,1
if not rs.eof then
if setpwd(pass)<>rs("pass") then response.redirect "news_dl.asp"
else
response.redirect "news_dl.asp"
end if
session("newspass") = pass
session("newsyhm") = rs("yhm")
rs.close
conn.close
response.redirect "news_admin.asp"
end if%>
<br>
</p>
<form name="from" method="post" action="news_dl.asp?dz=<%=dz%>">
<table align="center">
<tr>
<td> 用户名</td>
<td>
<input type="text" name="yhm" size="10" maxlength="10"></td>
</tr>
<tr>
<td>密 码</td>
<td>
<input type="password" name="pass" size="10" maxlength="10"> </td>
</tr>
</table>
<table cellpadding="4" cellspacing="0" align="center">
<tr>
<td align="center">
<input type=submit onclick="javascript:return dl(yhm.value,pass.value);" value="登 陆">
    
<input type="button" value="返 回" onClick="javascript:window.location='news.asp';">
</td>
</tr>
</table>
</form>
</center>
</body>
</htm>
<script language='javascript'>
function dl(yhm,pass)
{
if (yhm=="")
{alert('输入用户名!');
document.from.yhm.focus();
return false;}
if (pass=="")
{alert('输入密码!');
document.from.pass.focus();
return false;}}
</script>

QQ185259693 ASP交流群体2318126
你只要在表单多一个 隐藏的就可以了~!