I was wondering how some of you developers kill a session after displaying a page. I have a validation function and a return page function that both rely on sessions that need to exist only prior to displaying one page and then they need to be imediately destroyed. Here is an example:
//if errors exist, redisply the form with error messages
if($fv->isError()) {
//get the error list
$errors = $fv->getErrorList();
//register an error session
$_SESSION['valError'] = $errors;
$prevPage = $_SESSION['prevPage'];
//send user to the page
header("location:$prevPage");
$_SESSION['valError'] = null;
$_SESSION['prevPage']= null;
exit();
See, the problem is the session are killed before the page is displayed. I want to show the page and then kill the sessions. Any advice would be apriceated. Thanks.