session problem

George Herson gherson at
Wed Jun 19 05:44:15 EDT 2002

When i click an <a> link to move to another page on my site, a new session is 
being created, and i don't know why.  (I've had sessions working before, even in 
this program that's now giving me problems.) On the page the click brings me to, 
$PHPSESSID's value is predefined to the original session id, so PHP remembers 
its value.  But when i re-start the session, PHP creates a new session with a 
new id, and any variables registered to the session are forgotten.

I've tried manually assigning this session id to the session, as shown below, 
but still, as soon as I call session_start() a new session is created.  What am 
i doing wrong?

On the page I hyperlink to:
session_id( $PHPSESSID );
session_start();              // Starts a brand new session.
$secondsessid=session_id();  // This assigns a new value.
echo "zerothsessid=$zerothsessid<br/>\
echo "firstsessid=$firstsessid<br/>\
echo "secondsessid=$secondsessid<br/>\

In my output I'll have, for example:

"string session_id ( [string id]) ...
If id is specified, it will replace the current session id. session_id() needs 
to be called before session_start() for that purpose."

About one in 15 tries this will work, i.e., all of $zerothsessid, $firstsessid, 
and $secondsessid are the same value.

My mod_php is 4.0.5.


More information about the talk mailing list