PHP when are $_SESSION vars evaluated?

JataddebyAber

New Member
So my issue is that I'm setting a message in a session var to carry over in a page redirect.And then setting the var to an empty string so it doesn't redisplay everytime.Like so:\[code\]if ($successMsgs || !empty($_SESSION['msg_success'])) { $success_block[] = '<ul id="success-block">'; foreach($successMsgs as $success) { $success_block[] = '<li>'.$success.'</li>'; } if (!empty($_SESSION['msg_success'])) { $success_block[]='<li>'.$_SESSION['msg_success'].'</li>'; $_SESSION['msg_success']=''; } $success_block[] = '</ul>'; $success_block = implode('',$success_block);}\[/code\]The problem is that the clearing of the session var seems to have a retro-active effect so the message never gets displayed. It only works if I take out the line that re-sets it to an empty string. I'm thinking there's something about when session vars are evaluated that I don't understand?
 
Top