Re: Plz help w/ global variables
| From: | Richard Lynch | Date: | Sun, 07 Jul 2002 22:05:43 +0000 |
| Subject: | Re: Plz help w/ global variables | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-105974@lists.php.net to get a copy of this message | ||
>To test global variables, I wrote the following PHP script:
>
>(1)<?php
>(2)session_start();
>(3)session_register("counter");
>(4)$counter++;
>(5)echo "$counter";
>(6)// header ("location:statistics/contents.php");
>
>PS: Richard, thank you for your reply, but I still don't understand why is
>not passed.
Once you tell the browser to go somewhere else, *EVERYTHING* else you might
have told it is ignored.
It might not be the way it ought to be, but that's the way it is.
One of the things it will ignore is the Cookies sent with session_start()
So if the browser ignores those Cookies, it doesn't them back on the next
page, and PHP doesn't realize it's the same browser.
*IF* you alter your header() to include the SESSION ID that the cookies
should have sent, you will achieve success:
header("Location: statistics/contents.php?PHPSESSID=", session_id());
--
Like Music? http://l-i-e.com/artists.htm