I am running Apache 2, PHP 5.0.5, and windows XP
I have one php file that populates a SESSION variable and another that
consumes it.
If I call the first one from the URL line of the browser, the form fills
correctly (i.e. the values are passed in the session)
If I call the first program from the second via an <a href> the session
is lost.
So, from the browser URL, the order would be:
[first.php]
session_start() ;
$_SESSION['foo'] = $foo;
session_write_c lose();
header("locatio n: second.php");
exit;
[second.php]
session_start() ;
$foo = $_SESSION['foo'];
print_r($foo);
This works.
If I change second.php to be:
session_start() ;
$foo = $_SESSION['foo'];
<a href="first.php ">first</a>
then the session is empty when the href is selected.
What am I missing?
-david-
I have one php file that populates a SESSION variable and another that
consumes it.
If I call the first one from the URL line of the browser, the form fills
correctly (i.e. the values are passed in the session)
If I call the first program from the second via an <a href> the session
is lost.
So, from the browser URL, the order would be:
[first.php]
session_start() ;
$_SESSION['foo'] = $foo;
session_write_c lose();
header("locatio n: second.php");
exit;
[second.php]
session_start() ;
$foo = $_SESSION['foo'];
print_r($foo);
This works.
If I change second.php to be:
session_start() ;
$foo = $_SESSION['foo'];
<a href="first.php ">first</a>
then the session is empty when the href is selected.
What am I missing?
-david-
Comment