i have a problem. i can create session variables, but i can't access
them across pages.
for example.
page2.php
Code:
<?php
// start the session
session_start() ;
header("Cache-control: private"); //IE 6 Fix
echo "<strong>St ep 2 - Register Session </strong><br />";
// Get the user's input from the form
$name = $_POST['name'];
// Register session key with the value
$_SESSION['name'] = $name;
// Display the sssion information:
?>
Welcome to my website <strong><? echo $_SESSION['name'];
?></strong>!<br />
Let's see what happens on the <a href="page3.php ">next page.</a><br
/><br />
page3.php
Code:
<?php
// start the session
session_start() ;
header("Cache-control: private"); //IE 6 Fix
?>
<strong>Step 3 - test Session Part II </strong><br />
Hey <strong><? echo $_SESSION['name']; ?></strong> Everything is still
working!<br /><br />
<strong>Pick an option:</strong><br />
Let's delete this session value now. <a href="page4.php ">Click
Here.</a><br />
Let's destroy this session. <a href="page5.php ">Click Here.</a><br
/><br />
on page2.php (after the _SESSION['name'] variable is set with a form
on another page) the value of the variable comes up fine. however on
page3.php, the value is blank. any thoughts why? i tried tinkering
with the php.ini (v.4.0 on a Win98 box) but nothing changed.
thanks in advance
them across pages.
for example.
page2.php
Code:
<?php
// start the session
session_start() ;
header("Cache-control: private"); //IE 6 Fix
echo "<strong>St ep 2 - Register Session </strong><br />";
// Get the user's input from the form
$name = $_POST['name'];
// Register session key with the value
$_SESSION['name'] = $name;
// Display the sssion information:
?>
Welcome to my website <strong><? echo $_SESSION['name'];
?></strong>!<br />
Let's see what happens on the <a href="page3.php ">next page.</a><br
/><br />
page3.php
Code:
<?php
// start the session
session_start() ;
header("Cache-control: private"); //IE 6 Fix
?>
<strong>Step 3 - test Session Part II </strong><br />
Hey <strong><? echo $_SESSION['name']; ?></strong> Everything is still
working!<br /><br />
<strong>Pick an option:</strong><br />
Let's delete this session value now. <a href="page4.php ">Click
Here.</a><br />
Let's destroy this session. <a href="page5.php ">Click Here.</a><br
/><br />
on page2.php (after the _SESSION['name'] variable is set with a form
on another page) the value of the variable comes up fine. however on
page3.php, the value is blank. any thoughts why? i tried tinkering
with the php.ini (v.4.0 on a Win98 box) but nothing changed.
thanks in advance
Comment