Re: SESSION problem

From: Date: Sat, 16 Aug 2008 12:09:10 +0000
Subject: Re: SESSION problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-278219@lists.php.net to get a copy of this message
Hello Tedd, it seems to be a naming problem. You may not use a numeric value for a variable name to store in $_SESSION. By assigning it to $_SESSION, you get a Notice: Unknown: Skipping numeric key 1 in Unknown on line 0 and in your second script a Notice: Undefined offset: 1 in yourpath\index1.php on line XX -> whatever line it was in your script If you define $_SESSION['var'.$i] = $i; or $_SESSION[$i.'var'] = $i; or even $_SESSION[$i.'.1'] = $i; the $_SESSION won't forget your vars on the way to script 2. But it's a bit strange, that you can use your numeric keys in script 1. I tried with other Superglobals like $_POST and $_COOKIE and they seem to accept numeric variable names. So, is that a php bug? But as the docu says "A valid variable name starts with a letter or underscore", I think you can not complain about it. Cheers Sabine tedd schrieb:
Hi gang: Arrggg -- what the heck is going on? I can't get anything to pass via SESSION -- what's wrong? Here's the example -- (all the code is there): I populate the $_SESSIONs here. http://www.webbytedd.com/b2/session-test/index.php If you click "Proceed to Step 2", you'll see that nothing is passed. Now, where did I go wrong? Cheers, tedd PS: I've tried this on two different servers and get the same results.


« previous php.general (#278219) next »