PHP session variables problem in Firefox

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=

What happened to firstvar and secondvar ?

If I do a echo $_POST["firstvar"], the value is printed properly in page2.php. What happens when it is assigned to a session variable ?

Important observation : EVERYTHING IS ABSOLUTELY FINE WHEN I USE Internet Explorer! THe problem is only with Firefox !!!

Can using $_POST reset a session variable in firefox? Has this problem been observed so far by anyone?



LVL 3
mganeshAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LhotchCommented:
Do you have cookies enabled for your firefox browser?
virmaiorCommented:
looking at your code, the lines:
session_register("firstvar_session");
session_register("secondvar_session");

are completely unnecessary.  Try running the same code without this.

other than this, there's no immediate explanation.  The only other possible explanation could if page2 auto redirects to page 3 using a header.  If this is the case, then the page might not end up setting the $_SESSION variables before you jump away.

generally, firefox has a tendency to hold sessons better than IE.  By this, I mean that every tab and window in FF shares the same session cookie.  In IE by contrast, opening a new window (but not from the same window) makes the entity distinct.  Opening a new window from a window which has a current session in IE will continue through.
mganeshAuthor Commented:
To Lhotch:  Yes, Cookies are enabled.

To virmaior:  As I understand, session_register() registers a variable as a session variable so that they can be referenced througout the session.  If these are not registered as session variables, how do I carry them over to page3.php ? Kindly explain.
virmaiorCommented:
session_register is completely unnecessary.  What is meant by registering the variable is that it now links $_SESSION['variablename'] to $variablename, not that it lets you use the variable as $_SESSION['variablename']
read the top portion of http://us2.php.net/session_register.

Also note the large number of cautions about using this function.  It's basically outdated and does more harm than good in modern php code.

that it's working in internet explorer but not firefox may just be incidental to the way they handle cookies (are your sessions functioning as client-side cookies?)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.