$_SESSION issue

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Kimmo Laine wrote:
Quoted text here. Click to load it

Unless next_page.php generates PHP, the script with this include will
only get HTML.

Quoted text here. Click to load it


    if (isset($_GET['foo'])) {
      echo '<?php echo $_GET[\'foo\']; ?>';
    } else {
      echo '<?php echo \'Not available\'; ?>';

File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

Re: $_SESSION issue

Tom wrote:
Quoted text here. Click to load it

The only way that I forsee this being expected behavior is if
$_POST['value_a'] == $_POST['value_b']

Usually when I am assigning an array to a session key, I will use:

$_SESSION['key'] = array('a'=>$a, 'b'=>$b);

I have never had any problems using either method, and tested that on my
two 5.1.1 installs which worked fine.

Justin Koivisto, ZCE - justin@koivi.com

Re: $_SESSION issue

Following on from Tom's message. . .
Quoted text here. Click to load it

The following code works 'as advertised':
$SES['value']['a'] = 'va';
$SES['value']['b'] = 'vb';
to give
Array ( [value] => Array ( [a] => va [b] => vb ) )

It works with $_SESSION too.

Are you operating in a foreach loop?  If so this is a Gotcha.

Although not particularly related to this problem but in a similar vein:  
Look up "variable variables" in the manual.

   // convert $ay['foo'] into $foo
   foreach($ay as $key => $val) {$$key = $ay[$key];}

PETER FOX Not the same since the bookshop idea was shelved
2 Tees Close, Witham, Essex.
Gravity beer in Essex  <http://www.eminent.demon.co.uk

Site Timeline