Receiving variable from session

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Konrad

    Receiving variable from session

    After I register variable in session :

    session_start() ;
    session_registe r($var);

    new page opens

    include("regist er2.php");

    At the page I fill some forms and send variables from forms to another
    page - with GET method.

    And now at the 3rd page I need to receive a variable from the session
    but it's empty. Interesing is that on the second page receiving $var
    from session works without any complications just by using:

    session_start() ;
    print ($var);

    I have no idea what I did wrong and I would be grateful for advices,
    maybe there is some other method of posting variables from "1st page
    to 3rd". Thanks
  • Joakim Cefalk

    #2
    Re: Receiving variable from session

    Do you have session_start() ; in your third document?



    Konrad wrote:[color=blue]
    > After I register variable in session :
    >
    > session_start() ;
    > session_registe r($var);
    >
    > new page opens
    >
    > include("regist er2.php");
    >
    > At the page I fill some forms and send variables from forms to another
    > page - with GET method.
    >
    > And now at the 3rd page I need to receive a variable from the session
    > but it's empty. Interesing is that on the second page receiving $var
    > from session works without any complications just by using:
    >
    > session_start() ;
    > print ($var);
    >
    > I have no idea what I did wrong and I would be grateful for advices,
    > maybe there is some other method of posting variables from "1st page
    > to 3rd". Thanks[/color]

    Comment

    • Tony Marston

      #3
      Re: Receiving variable from session

      If your environment has register_global s turned off then you should not be
      using session_registe r(). After performing session_start() in a script you
      can put entries into and read entries out of the $_SESSION array.

      To use session variables you MUST have performed session_start() earlier in
      the script. It is this function which populates the $_SESSION array.

      --
      Tony Marston

      This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL



      "Konrad" <konio@eranet.p l> wrote in message
      news:518b4831.0 409020358.1bc70 d17@posting.goo gle.com...[color=blue]
      > After I register variable in session :
      >
      > session_start() ;
      > session_registe r($var);
      >
      > new page opens
      >
      > include("regist er2.php");
      >
      > At the page I fill some forms and send variables from forms to another
      > page - with GET method.
      >
      > And now at the 3rd page I need to receive a variable from the session
      > but it's empty. Interesing is that on the second page receiving $var
      > from session works without any complications just by using:
      >
      > session_start() ;
      > print ($var);
      >
      > I have no idea what I did wrong and I would be grateful for advices,
      > maybe there is some other method of posting variables from "1st page
      > to 3rd". Thanks[/color]


      Comment

      • Konrad

        #4
        Re: Receiving variable from session

        I do have a session_start() . Actually I realized that problem concerns
        PHPTriad configuration. After registering variable to session, the
        session file includes only a variable name - without it's value. Maybe
        you could advice me how to configure PHP Triad ;). Thanks for any
        requests.

        Comment

        Working...