How do you clear Session Variables?
Posted: Thu Feb 10, 2011 6:37 am
I have this posted to a file:
Once the content of this variable is used, I want to clear it, so that if the page is processed again, without passing anything to it, it won't just run the script.
The query does check that the contents of 5 variables are not NULL.
I have set all of these variables, after the script is run, to null:
Yet when I run the page that processes them, it passes through and completes the task, even though I have set them to NULL.
Is there a better way of clearing these session variables?
Code: Select all
if(isset($_POST['raceid']))
{
$raceid = $_POST['raceid'];
$_SESSION['raceid']=$raceid;
} else { $raceid=$_SESSION['raceid'];
}The query does check that the contents of 5 variables are not NULL.
I have set all of these variables, after the script is run, to null:
Code: Select all
$raceid = NULL;Is there a better way of clearing these session variables?