Re: SESSION array problems [SOLVED]

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

 



Hi gang:

As strange as it may seem, but when session variables are passed to another page (i.e., used) you cannot extract ALL OF THEM using a loop when the variable names you are using are the same as the SESSION index's names.

In other words, you cannot do this:

for ($i = 0; $i < $num_users; $i++)
   {
   $last_name = $_SESSION['last_name'][$i];
   $first_name = $_SESSION['first_name'][$i];
   echo("<p>$last_name $first_name</p>");
   }

But you can do this:

for ($i = 0; $i < $num_users; $i++)
   {
   $last = $_SESSION['last_name'][$i];
   $first = $_SESSION['first_name'][$i];
   echo("<p>$last $first</p>");
   }

See the difference?

This was a crazy one.

Now, someone show me where that is documented?

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
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