On a page within my program I need to delete a number of variables, but I need some of the session variables to remain. I''m trying to use the following code to do this, but it is only allowing the $username1 and $id1 variables to remain (in other words, it is deleting everything except the username1 and id1 session variable).
What am I doing wrong? I've tried looking at php.net and its explanations of SESSION destroy and what-not, but I didn't understand what it meant.
Please help!
Landis
foreach ($_SESSION as $key => $value)
{
if ($key != 'username1' && $key != 'id1' && $key != 'referee_name1' && $key != 'f_name1' && $key != 'l_name1' && $key != 'state1' && $key != 'region1' && $key != 'assignor1_2' && $key != 'assignor2_2' && $key != 'assignor3_2' && $key != 'assignor4_2' && $key != 'assignor5_2' ) {unset($_SESSION[$key]);}
}