日期:2014-05-17  浏览次数:20495 次

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大写