Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Apr 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question PHP $_SESSION doesn't work

    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

  • #2
    Regular Coder
    Join Date
    Jul 2002
    Location
    This little Earth.
    Posts
    383
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    'If you don't stand for something, you'll fall for anything.'

  • #3
    New to the CF scene
    Join Date
    Apr 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    This little Earth.
    Posts
    383
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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/functio...n-register.php
    'If you don't stand for something, you'll fall for anything.'

  • #5
    Regular Coder
    Join Date
    Apr 2003
    Location
    Canada, Ontario, Mississauga
    Posts
    312
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hello

    Can someone help me out??

    Session

    Thank you,

    Mike


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •