I have an anchor that is a “Log Out” anchor when it is clicked, I send it to another page that distroys the PHP session but the the “Login” information still shows after this like for example “Welcome Andrew”, I have to refresh the page once again so that it actually picks it up and then the “Welcome Andrew” changes to “Please Login”, what can I do so that when the anchor is clicked and it goes to that other page, it destroys the session and shows “Please Login” without having to refresh it?
<a href="logout.php"> Log Out</a>
Log Out PHP
<?php
session_destroy();
?>
After it gets to logout.php, it still shows “Welcome Andrew” but if I refresh it shows “Please Log in” how can I do it so I dont have to refresh?
Thank you
That’s because that’s how sessions work. Just to keep it clean and make sure it’s all good, I’d recommend something more like: