Guru Forum - Aliro, PHP, Mambo, Joomla, ...


Reply
 
Thread Tools Display Modes
  #1  
Old July 8th, 2009, 04:58 AM
gilbertsavier gilbertsavier is offline
Banned
 
Join Date: Jun 2009
Posts: 1
Default 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=
Reply With Quote
  #2  
Old July 8th, 2009, 09:16 AM
counterpoint counterpoint is offline
Administrator
 
Join Date: Jun 2007
Posts: 200
Default

Could you clarify how the flow passes from one PHP file to another?

Have you used a diagnostic of some kind to find out whether there was anything in $_POST?

It is better not to use session_register() which should not be needed anyway. It is deprecated in PHP 5.3 and removed in PHP 6.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:13 PM.


A vBSkinworks Design
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Posts copyright respective authors; compilation copyright Aliro Ltd