Posted by David Haynes on 02/26/06 00:28
Janwillem Borleffs wrote:
> David Haynes wrote:
>> 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;
>>
>
> Where is $foo initially defined?
>
>
> JW
>
>
$foo just represents some meaningful data.
I have a real minimal example now:
[file: foo.ctrl.php]
<?php
session_start();
$foo[] = array('this'=>1, 'that'=>2);
$_SESSION['foo'] = $foo;
session_write_close();
header('location: foo.php');
exit;
?>
[file: foo.php]
<?php
session_start();
printf("_SESSION<br>\n");
$foo = $_SESSION['foo'];
print_r($foo);
echo <<<EOF
<html>
<head></head>
<body>
<br/>
<a href="foo.ctrl.php>foo</a>
</body>
EOF;
?>
Calling foo.ctrl.php from the browser URL produces:
_SESSION
Array ( [0] => Array ( [this] => 1 [that] => 2 ) )
foo
clicking on the 'foo' link produces:
_SESSION
foo
-david-
Navigation:
[Reply to this message]
|