Reply to Re: Confusing session behaviour

Your name:

Reply:


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-

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация