Re: SESSION problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux