当前位置: 代码迷 >> PHP >> Lost session varible between pages,该怎么解决
  详细解决方案

Lost session varible between pages,该怎么解决

热度:575   发布时间:2012-02-13 17:20:26.0
Lost session varible between pages
movie1.php
<?php session_start();
$_session['username']="Jhon";
$_session['authuser']=1;
?>
<html>
<head>
<title>Find my favorite movie!</title>
</head>
<body>
<?php
$myfavmovie=urlencode("transformers");
echo "<a href='moviesite.php?favmovie=$myfavmovie'>";
echo "Click here to see information about my favorite movie!</a>";
echo "<br>".$_session['username']; //ok, display Jhon



?>
</body>
</html>

moviesite.php
<?php session_start();
/*
if ($_session['authuser'] != 1){
echo $_session['authuser'];
echo "Sorry, but you don't have pemission to view the page, you loser!";
exit();
}
*/
?>
<html>
<head>
<title>My movie site - <?php echo $_request['favmovie']; ?></title>
</head>
<body>
Welcome to our site, 
<?php echo $_session['username'] ?>! //doesn't work, display nothing,why?
<br>My favorite movie is 
<?php echo $_request['favmovie'] ?>! //doesn't work, display nothing,why?
<br>
<?php $movierate=5; ?>
My movie rating for this movie is: 
<?php echo $movierate; ?>
</body>
</html>

//register_globles = OFF

------解决方案--------------------
$_SESSION大写
  相关解决方案