帮帮忙。谢谢了。

lzd1024 2005-09-28 03:08:21
我在a页面写的这句
<%set session("yhmc")=request.QueryString("yhmc")%>
b页面<% =session("yhmc")%>
我的目的是在a 页面输入的东西在b页面显示??谢谢了。·
...全文
85 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
lzd1024 2005-09-28
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/sjk.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
if session("yhmc")<>"" then %>
<table width="270" height="40" border="0" cellpadding="0" cellspacing="0" bgcolor="#F3F9DF">
<tr>
<td align="center" valign="middle">


<table width="270" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="left"><span class="center03"><strong>用户名:</strong></span> <span class="center03"></span> <%=session("yhmc")%>
</div></td>
</tr>
<tr>
<td> <div align="left">用户已经登录</div></td>
</tr>
</table>
</td>
</tr>
</table>
<%else%>
<form style="width:270px; height:40px; " name="form1" method="POST" action="<%=MM_LoginAction%>">
<table width="270" height="40" border="0" cellpadding="0" cellspacing="0" bgcolor="#F3F9DF">
<tr>
<td align="center" valign="middle">


<table width="270" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="right"><span class="center03"><strong>用户名:</strong></span>
<input name="yhmc" type="text" class="login_input1" id="yhmc">
<span class="center03"><strong>密码:</strong></span>
<input name="mima" type="password" class="login_input1" id="mima">
</div></td>
</tr>
<tr>
<td>
<div align="right">
<input style="width:80; height:18;" type="submit" name="Submit" value="提交"><%session("yhmc")=request("yhmc")%>
<input style="width:80; height:18;" type="reset" name="Submit" value="重置">
<input style="width:80; height:18;" type="button" name="Submit" value="注册" onclick="javascript:window.location.href='zcxx.asp';">
</div></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<%
end if
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("yhmc"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="denglu.asp"
MM_redirectLoginFailed="logo.htm"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_sjk_STRING
MM_rsUser.Source = "SELECT name, pass"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM yonghu WHERE name='" & Replace(MM_valUsername,"'","''") &"' AND pass='" & Replace(Request.Form("mima"),"'","''") & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<link rel = stylesheet href = "1.css" type = "text/css">
<html>
<style type="text/css">
<!--
-->
</style><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
</body>
</html>
这回我把代码这么写了。也不报错了。只运行的时候输入一次就总是在“用户admin以登陆”那里了。
重器机器都在那了里,就是不让输入用户名密码了?气死我了。
再帮帮我吧。
lnboy1003 2005-09-28
  • 打赏
  • 举报
回复
感觉你写的对啊
jspadmin 2005-09-28
  • 打赏
  • 举报
回复
<%session("yhmc")=request("yhmc")%> 去掉set 和.QueryString
b页面<% =session("yhmc")%>
ybfqlyq 2005-09-28
  • 打赏
  • 举报
回复
<% Dim yhmc
yhmc=request.QueryString("yhmc")
session("yhmc") = yhmc %>
把這些放在MM_LoginAction = Request.ServerVariables("URL")代碼的下面。。
那個按鈕的<input .... onclick="javascript:window.location.href='aa.asp';">
jspadmin 2005-09-28
  • 打赏
  • 举报
回复
<a href="next.asp"><INPUT TYPE="button" value="到下页"></a>
lzd1024 2005-09-28
  • 打赏
  • 举报
回复
还有的小问题。我的注册按钮下怎么加连接转到下页
lzd1024 2005-09-28
  • 打赏
  • 举报
回复
不行啊。我把全部给你们看看吧。
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/data.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("yhmc"))
If MM_valUsername <> "" Then
MM_fldUserAuthorization=""
MM_redirectLoginSuccess="dlcg.asp"
MM_redirectLoginFailed="index.asp"
MM_flag="ADODB.Recordset"
set MM_rsUser = Server.CreateObject(MM_flag)
MM_rsUser.ActiveConnection = MM_data_STRING
MM_rsUser.Source = "SELECT name, pass"
If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
MM_rsUser.Source = MM_rsUser.Source & " FROM yhxx WHERE name='" & Replace(MM_valUsername,"'","''") &"' AND pass='" & Replace(Request.Form("mima"),"'","''") & "'"
MM_rsUser.CursorType = 0
MM_rsUser.CursorLocation = 2
MM_rsUser.LockType = 3
MM_rsUser.Open
If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
' username and password match - this is a valid user
Session("MM_Username") = MM_valUsername
If (MM_fldUserAuthorization <> "") Then
Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
Else
Session("MM_UserAuthorization") = ""
End If
if CStr(Request.QueryString("accessdenied")) <> "" And false Then
MM_redirectLoginSuccess = Request.QueryString("accessdenied")
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginSuccess)
End If
MM_rsUser.Close
Response.Redirect(MM_redirectLoginFailed)
End If
%>
<link rel = stylesheet href = "1.css" type = "text/css">
<html>
<style type="text/css">
<!--
-->
</style><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<form ACTION="<%=MM_LoginAction%>" style="width:270px; height:40px; " name="form1" method="POST">
<table width="270" height="40" border="0" cellpadding="0" cellspacing="0" bgcolor="#F3F9DF">
<tr>
<td align="center" valign="middle">


<table width="270" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="right"><span class="center03"><strong>用户名:</strong></span>
<input name="yhmc" type="text" class="login_input1" id="yhmc">
<span class="center03"><strong>密码:</strong></span>
<input name="mima" type="password" class="login_input1" id="mima">
</div></td>
</tr>
<tr>
<td>
<div align="right">
<input style="width:80; height:18;" type="submit" name="Submit" value="提交">
<% Dim yhmc
yhmc=request.QueryString("yhmc")
session("yhmc") = yhmc %>
<input style="width:80; height:18;" type="reset" name="Submit" value="重置">
<input style="width:80; height:18;" type="button" name="Submit" value="注册">
</div></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
</body>
</html>
以上是a页面,最上面我用的dreamweaver中的服务器行为做的登陆登陆
<%@LANGUAGE="VBSCRIPT"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<body>
<%
yhmc =session("yhmc")
%>

<table width="270" height="40" border="0" cellpadding="0" cellspacing="0" bgcolor="#F3F9DF">
<tr>
<td align="center" valign="middle">
<table width="270" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="left"><span class="center03"><strong>用户名:</strong></span> <% =yhmc %>
</div></td>
</tr>
<tr>
<td>
<div align="left">用户已经登录</div></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
这是b页面
不报错但在b页面显示不出来登陆的用户。
帮帮谢谢了。
ybfqlyq 2005-09-28
  • 打赏
  • 举报
回复
樓上的是對的
duy02 2005-09-28
  • 打赏
  • 举报
回复
你那么写不行么?
我一般怎么写
我在a页面写的这句
<%
Dim yhmc
yhmc=request.QueryString("yhmc")
session("yhmc") = yhmc
%>
b页面
<%
yhmc =session("yhmc"
%>
<%=yhmc%>
haver.G 2005-09-28
  • 打赏
  • 举报
回复
那就应该在B页面接收。

28,406

社区成员

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

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