Session Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dhaval321
    New Member
    • May 2007
    • 21

    #1

    Session Problem

    Hi all,
    i have used seessions in php 5..Tried all ways to run the session variable on the new page. but not able to fetch it. code is

    on Page1:

    session_start() ;
    $temp = 'xyz";
    $_SEESION['tmp'] = $temp;
    header("Locatio n: Page2.php");

    And on Page2:

    session_start() ;
    echo $_SEESION['tmp'];

    But i am not able to fetch variable on page2..Even i have tried using session_registe r also..But it is also not workin..And the same code is running on php4..I dont know wht is problem in php5..If any changes to be made in php.ini file then please suggest.I am in big trouble
  • nathj
    Recognized Expert Contributor
    • May 2007
    • 937

    #2
    Originally posted by dhaval321
    Hi all,
    i have used seessions in php 5..Tried all ways to run the session variable on the new page. but not able to fetch it. code is

    on Page1:

    session_start() ;
    $temp = 'xyz";
    $_SEESION['tmp'] = $temp;
    header("Locatio n: Page2.php");

    And on Page2:

    session_start() ;
    echo $_SEESION['tmp'];

    But i am not able to fetch variable on page2..Even i have tried using session_registe r also..But it is also not workin..And the same code is running on php4..I dont know wht is problem in php5..If any changes to be made in php.ini file then please suggest.I am in big trouble
    It may be the register_global s in your php.ini file. I believe this needs to be set to Off. But check the php manual on sessions to clarify.

    nathj

    Comment

    • dhaval321
      New Member
      • May 2007
      • 21

      #3
      HI Nathj.
      Thanks for ur interest . i have checked tht register_global s in php.ini file and it is set off there.so i think no issue of that . i have also visited tht page which u specified . i know all, still having problems..can u suggest me how to come out?

      Comment

      • erp23
        New Member
        • Aug 2007
        • 26

        #4
        have you tried checking whether the session is set?

        [PHP]if (!isset($_SESSI ON)) {
        session_start() ;[/PHP]

        Also, why are you spelling it SEESION instead of SESSION?

        Comment

        • kovik
          Recognized Expert Top Contributor
          • Jun 2007
          • 1044

          #5
          Originally posted by erp23
          Also, why are you spelling it SEESION instead of SESSION?
          Hehe, nice to see that someone noticed. ;)

          Comment

          • dhaval321
            New Member
            • May 2007
            • 21

            #6
            Originally posted by erp23
            have you tried checking whether the session is set?

            [PHP]if (!isset($_SESSI ON)) {
            session_start() ;[/PHP]

            Also, why are you spelling it SEESION instead of SESSION?


            Oh ya, by mistake i have written seesion here but in program it is $_SESSION. And ya i have tried isset() in another page but still no progress.

            Comment

            Working...