Reputation: 1008
I am trying to redirect to another page upon breaking a session and destroying session variables.
Here is my code to logout:
<?php
_$SESSION['signin'] = null;
session_destroy();
header("Location: /index.php");
?>
I thought this was quite straight forward, however it simply stays on the logout.php page, and does not get redirected to the index page.
I assume his has something to do with destroying the session, kind of like an "exit" in php.
How can I go about redirecting then though?
Upvotes: 0
Views: 1074
Reputation: 4108
you appear to heave a simple syntax error in your first line:
WAS:
_$SESSION['signin'] = null;
It should be:
$_SESSION['signin'] = null;
NOTE: You probably have error messages suppressed/hidden. When in development, you should have them enabled, you would have figured out this error very easily.
Upvotes: 1