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
https://forums.phpfreaks.com/topic/224223-help-with-sessions/
Share on other sites

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.