Why not get the needed data in a controller and pass it to a view. Otherwise don't unset it there, unset in a condition somewhere.
Feb 15, 2023
6
Level 20
unset session on leaving a certain page?
my session
<div>
<?php if(isset($_SESSION['message'])) :?>
<span class=" session fixed bg-blue-500 text-white py-2 px-4 rounded-xl bottom-3 right-3">
<?php echo $_SESSION['message'];?>
</span>
<?php endif ?>
<?php unset($_SESSION['message']) ?>
</div>
by using unset() it is unset on the page on which i need to show it and when i comment the unset() it show the session data to all pages.. :(
Please or to participate in this conversation.