Page 1 of 1

php session problem

Posted: Sat Nov 27, 2010 3:10 pm
by vijay_587
hello,
I am beginner in php.....I got a problem in following script
<?php
session_start();
$logout = $_POST['logout'];
if(isset($logout)){
unset($_SESSION['uname']);
unset($_SESSION['password']);
session_destroy();
header('location:registrationform.php');
}
?>
according to the above script when i click on logout button my page go to my registrationform page but when i click back button in my browser it goes back to above script means to the logout page....what is the reason for that......i also want to know how to setup my session from login till logout.
thanks in advance.

Re: php session problem

Posted: Sat Nov 27, 2010 5:54 pm
by Christopher
You want ot check if the actual $_POST variable is set:

Code: Select all

if(isset($_POST['logout'])){