|
Posted by Xylene2301 on 09/29/84 12:00
Here are snips from 2 pages; tst1.php and tst2.php
tst1.php echos the session id, then sets and echos a session variable called
username.
pressing a button on tst1.php submits to a form tst2.php which echos the
session id (successfully) and attempt to echo the username session vaiable
(fails). Why not?
The code is running on a shared server at Dreamhost, a really big hosting
svc. It's running php 4.4.7, register_globals is on,session support is
enabled.
Thanks for any help.
Here are the pages:
tst1.php************************************
<?php
session_start(); // start the session
$_SESSION['username'] = "Goody";
echo $PHPSESSID ."<br>";
echo $_SESSION['username'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>tst1</title>
</head>
<body>
<form method="post" name="ThisForm" action="tst2.php">
<button onclick="submit()">t2</button>
</form>
</body>
</html>
tst2.php************************************
<?php
echo $PHPSESSID ."<br>";
echo $username;
echo $_SESSION['username'];
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>tst2</title>
</head>
<body>
<form method="post" name="ThisForm" action="tst1.php">
<button onclick="submit()">t1</button>
</form>
</body>
</html>
Navigation:
[Reply to this message]
|