...

View Full Version : PHP $_SESSION doesn't work



deva
04-19-2003, 12:44 PM
Hi every1 I've recently installed php 4.0.6 and I found out that it doesn't keep $_SESSION stuff.
I checked phpinfo() and everything seems ok: ...
--enable-trans-sid , Session Support enabled, session.use_trans_sid 1, session.name PHPSESSID...
$PHPSESSID works and I printed it:
13824a92bb7f8549406ed616283a8be00
But if I try to store values like $_SESSION["a"] = "hello" and then call $_SESSION["a"] from anoter page ... nothing at all. I used session_start() at the top of the page.
thanx
regards

ASAAKI
04-19-2003, 02:47 PM
i think that in ur version of php u need to add this before using ur session variable:
session_register('a');

you may know this already but "session_start();" should be added at the top of each page. to check on each page before using the session variable:

if(!session_is_registered('a')){
session_register('a');
}

also check if register_globals is turned on or off. if it is, then rather than using $_SESSION, you should use $HTTP_SESSION_VARS.

deva
04-19-2003, 03:02 PM
hello.
register_globals is on.
so either I get a newer version of php or start using session_register?!

>>rather than using $_SESSION, you should >>use $HTTP_SESSION_VARS.

what's wrong with $_SESSION?

thanx a lot.

ASAAKI
04-19-2003, 03:10 PM
nothing's wrong with $_SESSION, in fact $_SESSION is the better thing to use now i guess. it's just a version-specific thing.

if u don't want to download a newer version, just try session_register.

http://www.php.net/manual/en/function.session-register.php

weronpc
04-21-2003, 12:12 AM
Can someone help me out??

http://codingforums.com/showthread.php?s=&threadid=18625

Thank you,

Mike



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum