Is it possible to do the following I have a three step registration form and on the last page I have 2 buttons one will submit the details into a mysql database and destroy the session and log the user out while the other will submit the details and bring you back to step one to register more items. This is the step that concerns me I want to bring the user back to step one destroying 4 of the ten session variable, is this possible ie is it possible to destroy just some session variables while carry forward ones you want.
Here is the code I am using at present to destroy them all.
If possible could someone shoe me how.
Regards and Thanks
-------------------------------------------------------- Code --------------------------------------------
// If no first name variable exists, redirect the user.
if (!isset($_SESSION['username']))
{
header ("Location: . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php");
ob_end_clean(); // Delete the buffer
exit(); // Quit the Script
}
else
{ // Log out the user
$_SESSION = array(); // Destroy the variables.
session_destroy(); // Destroy the session itself
setcookie (session_name(), '' , time()-300, '/' , '',0); // destroy the cookie
}
echo '<div id = "contentform">';
// Print a customized message
echo "<h1>You are now logged out.</h1>";
echo '</div>';
Here is the code I am using at present to destroy them all.
If possible could someone shoe me how.
Regards and Thanks
-------------------------------------------------------- Code --------------------------------------------
// If no first name variable exists, redirect the user.
if (!isset($_SESSION['username']))
{
header ("Location: . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php");
ob_end_clean(); // Delete the buffer
exit(); // Quit the Script
}
else
{ // Log out the user
$_SESSION = array(); // Destroy the variables.
session_destroy(); // Destroy the session itself
setcookie (session_name(), '' , time()-300, '/' , '',0); // destroy the cookie
}
echo '<div id = "contentform">';
// Print a customized message
echo "<h1>You are now logged out.</h1>";
echo '</div>';