I would like to clear my session vqriqble "flash' using the unset function but now I can't print my flash message because the unset function is called before my previous code. It is called in my header template : header.php wich is called in every page at the beginning of the code.
This is the code :
<?php if(isset($_SESSION['flash'])): ?>
<?php foreach($_SESSION['flash'] as $type => $message): ?>
<div class="alert alert-<?= $type; ?> bk-fullwidth-alert">
<p><?= $message; ?></p>
</div>
<?php endforeach; ?>
<?php unset($_SESSION['flash']); ?>
<?php endif; ?>
Thank you guys for your help !