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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.