Jump to content

Subsequent page not reading session variable?


vesper

Recommended Posts

hi, i am wondering if someone out there may be able to help? i have <?php session_start(); ?> as the very first line on the first page of my site.

 

when i authenticate the user logon, i assign data read from the database to the session variables:

 

$_SESSION['sessionVariable1'] = $row['dbData1'];

$_SESSION['sessionVariable2'] = $row['dbData2'];

$_SESSION['sessionVariable3'] = $row['dbData3'];

$_SESSION['sessionVariable4'] = $row['dbData4'];

 

the variable names above are just made up, not those in the actual code, but you get the idea.

 

if i display the session variables using echo $_SESSION['sessionuserVariable1']; in the same page that I create them in there is no problem. however, once authentication has taken place the user is redirected using 'header'. the page the user is redirected to can not display the session variables!

 

does anyone have any idea why it is doing this?

Have every pages where are you are using session contains "session_start();" ?

 

If not then mention "session_start()" at first line of every pages.

 

hi, thanks for replying. no they don't. only the first page (index.php) contains "session_start()". i'll give it a try.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.