...

View Full Version : How to clear the data inside session variables?



Det7
06-27-2005, 04:44 AM
guys, how am i going to clear data inside session variables?
in every page, i put a

session.start();

so i will be able to access the data that I stored inside the session variables.
Now what I want to have a "RESET" function (button, link, etc) that will
clear the data inside the session variables.

I tried using a "RESET" link inside "home.php"
<a href = "reset.php">RESET</a>

inside "reset.php"..
<?php
session.close();
header('home.php'); // this is the page where I initialize the session
?>

inside "home.php"..
<?php
session.start();
.. // some code where I store data inside the session
?>
<a href = "reset.php">RESET</a> // reset link

What do you think guys? I closed the session and started it again? I should get a session different from the previous one, right?

Kurashu
06-27-2005, 04:55 AM
foreach($_SESSION as $key=>var)
{
unset($_SESSION[$key]);
}

ALSO, it is session_start and session_close. Underscore, not a period.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum