PHPSESSID will not be set on the first request. On the first request to a
page with session_start(), PHP creates a session and sends a cookie named
PHPSESSID to the browser. When the browser returns the cookie in the next
request, PHPSESSID gets put into $HTTP_COOKIE_VARS[] array, and if
register_globals is on, it also gets put into the global variable space.

If you need the session ID on the first request, it is availabe in the
constant SID. Try putting this into your code and see what you get:

echo "SID is " . SID . "<br>";

I believe you can also do something like:

$PHPSESSID = session_id();


> -----Original Message-----
> From: Ryan Kelley [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 08, 2002 7:13 PM
> Subject: Re: [PHP] Sessions
> I actually fixed the problem with the following code:
> session_start();
> Except that it will not assign an actual value until i hit 
> refress on my
> browser. Any ideas for a fix?

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to