Jump to content

Help with sessions


benphp

Recommended Posts

I haven't used sessions much until now, so this is probably due to my ignorance. I have a page that sets the session variable, and if I print from that page, the session variable (an array) is correct. But when I move to the next page, the same session variable has old, old, wrong data. The $arrAttendeeList  is an exploded list from a textarea on a form turned into an array. Example:

 

This page, let's call it page1.php, sets the variable:

 

<?php
$_SESSION['arrAttendeeList'] = $arrAttendeeList;

foreach ($_SESSION['arrAttendeeList'] as $temp) {
print "$temp <br />";
}
exit;
?>

 

Results:

 

Smithers, Waylon

Bouvier, Selma

Brockman, Kent

 

But the next page, page2.php, when I call the same variable:

 

<?php
foreach ($_SESSION['arrAttendeeList'] as $temp) {
print "<br />$temp <br>";
}
?>

 

I get yesterday's data:

 

Smithers, Waylon 

Bouvier, Selma

 

I've tried setting the session var to null but with the same results. Do I need to kill the session var before setting it to something else?

 

Thanks -

 

 

 

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.