PHP session variables problem in Firefox

Discussion in 'PHP' started by gilbertsavier, Jul 17, 2009.

  1. gilbertsavier

    gilbertsavier New Member

    Joined:
    Jun 25, 2009
    Messages:
    9
    Likes Received:
    0
    Trophy Points:
    0
    Hi,
    I have developed a small application for my company on PHP but have some small difficulty to overcome. In fact some session variables are getting vanished mysteriously.
    Here is the flow :

    index.php->page1.php->page2.php->page3.php

    Here are the excerpts from the files.

    index.php :

    session_start();
    session_register("username_session");
    session_register("fullname_session");
    $_SESSION["username_session"]=<value from database>
    $_SESSION["fullname_session"]=<value from database>

    page1.php :

    Nothing related to session or session variables in this page. Just pass on a few form fields to next page.
    The form fields are "firstvar" and "secondvar"

    page2.php :

    session_start();
    session_register("firstvar_session");
    session_register("secondvar_session");

    $_SESSION["firstvar_session"]=$_POST["firstvar"]
    $_SESSION["secondvar_session"]=$_POST["secondar"]


    page3.php:

    I access session variables here

    session_start();
    echo "username=".$_SESSION["username_session"]."<BR>";
    echo "fullname=".$_SESSION["fullname_session"]."<BR>";
    echo "firstvar=".$_SESSION["firstvar_session"]."<BR>";
    echo "secondvar=".$_SESSION["secondvar_session"]."<BR>";



    Here is the output :

    username=ganesh
    fullname=M. Ganesh
    firstvar=
    secondvar=
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Do you have session_start in page1 or not ?
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice