$_SESSION comes empty on next page

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

    $_SESSION comes empty on next page

    Hello all,

    I am not able to find the solution to this problem :(.
    I have two php pages . On the first page i am getting some values in
    $_SESSION when i use print_r function. I don't get the values when i
    use just echo() or print() functions.
    Now, the first page calls the second php page. But when i try to get
    the values for $_SESSION on the second page i get empty values even
    when i use print_r() function.
    register.global s is set to on in php.ini. I am also using
    start_session() on these pages but to no effect.

    Can any one pleez help me out ??? Any kind of help will be
    appreciated.

    Thanks in advance.
  • The Plankmeister

    #2
    Re: $_SESSION comes empty on next page


    "tornado" <tornado579@yah oo.com> wrote in message
    news:c8b0a275.0 401150117.addbd a7@posting.goog le.com...[color=blue]
    > Hello all,
    >
    > I am not able to find the solution to this problem :(.
    > I have two php pages . On the first page i am getting some values in
    > $_SESSION when i use print_r function. I don't get the values when i
    > use just echo() or print() functions.
    > Now, the first page calls the second php page. But when i try to get
    > the values for $_SESSION on the second page i get empty values even
    > when i use print_r() function.
    > register.global s is set to on in php.ini. I am also using
    > start_session() on these pages but to no effect.
    >
    > Can any one pleez help me out ??? Any kind of help will be
    > appreciated.
    >
    > Thanks in advance.[/color]

    It'd be useful to see your code... Post it up. It's quite tricky to give
    advice on a potentially tricky issue if there's no source code to look at.

    Plankmeister.


    Comment

    • Christopher Finke

      #3
      Re: $_SESSION comes empty on next page

      "tornado" <tornado579@yah oo.com> wrote in message
      news:c8b0a275.0 401150117.addbd a7@posting.goog le.com...[color=blue]
      > I have two php pages . On the first page i am getting some values in
      > $_SESSION when i use print_r function. I don't get the values when i
      > use just echo() or print() functions.
      > Now, the first page calls the second php page. But when i try to get
      > the values for $_SESSION on the second page i get empty values even
      > when i use print_r() function.[/color]

      I had a similar problem recently (Win2000, IIS), and it turned out that PHP
      did not have write-access to whatever directory that the session data was
      stored in. You may want to look into this.

      Chris Finke


      Comment

      • Dasher

        #4
        Re: $_SESSION comes empty on next page

        The session ID is different for each window instance. So if this is a new
        instance of a window you will need to pass the session id to the new window
        when you launch it.

        If it is in the same browser window then you should be able to get session
        variables without passing the variable.

        "tornado" <tornado579@yah oo.com> wrote in message
        news:c8b0a275.0 401150117.addbd a7@posting.goog le.com...[color=blue]
        > Hello all,
        >
        > I am not able to find the solution to this problem :(.
        > I have two php pages . On the first page i am getting some values in
        > $_SESSION when i use print_r function. I don't get the values when i
        > use just echo() or print() functions.
        > Now, the first page calls the second php page. But when i try to get
        > the values for $_SESSION on the second page i get empty values even
        > when i use print_r() function.
        > register.global s is set to on in php.ini. I am also using
        > start_session() on these pages but to no effect.
        >
        > Can any one pleez help me out ??? Any kind of help will be
        > appreciated.
        >
        > Thanks in advance.[/color]


        Comment

        • Miguel Garcia

          #5
          Re: $_SESSION comes empty on next page

          tornado579@yaho o.com (tornado) wrote in message news:<c8b0a275. 0401150117.addb da7@posting.goo gle.com>...[color=blue]
          > Hello all,
          >
          > I am not able to find the solution to this problem :(.
          > I have two php pages . On the first page i am getting some values in
          > $_SESSION when i use print_r function. I don't get the values when i
          > use just echo() or print() functions.
          > Now, the first page calls the second php page. But when i try to get
          > the values for $_SESSION on the second page i get empty values even
          > when i use print_r() function.
          > register.global s is set to on in php.ini. I am also using
          > start_session() on these pages but to no effect.
          >
          > Can any one pleez help me out ??? Any kind of help will be
          > appreciated.
          >
          > Thanks in advance.[/color]

          1-have you set session.save_pa th ?
          2-if you are using virtualhosts put this at the top of your .php file:
          session_set_coo kie_params(3200 , '/', $_SERVER['HTTP_HOST']);

          Comment

          Working...