一个session传值的问题

boystones boystones 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
ddddaaaaaa.php
========================================================
<?php
require 'zys_config.php';

session_start();
if($_POST['name']==''||$_POST['pwd']=='')
{
echo "请输入用户名和密码" ;
}
else
{
$conne=mysql_connect("localhost",DB_USER,"5049") or die("could not connect");
mysql_select_db("zysshop168",$conne) or die("could not select");
$query="select pwd from userinfo where name='$_POST[name]' ";
$res=mysql_query($query);
$row = mysql_fetch_object($res);
$_session['name']=$_POST[name];
if ( $row->pwd==trim($_POST[pwd]) ){
echo "<meta http-equiv=refresh content=0;url=Untitled-1.php>";
}
else
{
echo "用户不存在!";
}
}
?>



Untitled-1.php
====================================================
<?php session_start(); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>无标题文档</title>
</head>
<body>

<table width="200" border="0">
<tr>
<td><form id="form1" name="form1" method="post" action="ddddaaaaaa.php">
<label>
<input name="name" type="text" id="name" />
</label>
<label>
<input name="pwd" type="password" id="pwd" />
</label>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
</form>
</td>
</tr>
</table>
<?php
echo $_SESSION['name'];
?>
</body>
</html>

为什么正确登录后想显示Untitled-1.php中的echo $_SESSION['name'];值显示不了。
...全文
评论 2
收藏 已收藏
分享
返回顶部
boystones
基础编程 21,889 成员 140,329 内容