0
<?php
        session_start();
    if (isset($_SESSION["Email"])) 
    {
           echo '<h1> Login Success, Welcome - ' . $_SESSION["Email"]. '</h1>';
    }
?>

This login success welcome,(email) keep showing after I logged in, is there any way to show it only once? even when I reload like it will disappear? I want this looping to stop please help me.

t.niese
  • 39,256
  • 9
  • 74
  • 101
jynrd
  • 1
  • 1
    Just add `unset($_SESSION['Email']);` in the `if` block – Terry Jun 08 '21 at 15:29
  • Does this answer your question? [How to remove a variable from a PHP session array](https://stackoverflow.com/questions/2231332/how-to-remove-a-variable-from-a-php-session-array) – Terry Jun 08 '21 at 15:29
  • Why is that tagged as `mysql`? – t.niese Jun 08 '21 at 15:36
  • `please help me ASAP! TY!` your question is not more important then any other question. – t.niese Jun 08 '21 at 15:38
  • 3
    I would prefer to set another session variable like `$_SESSION["msgShown"] = true;` And have it in `if (isset($_SESSION["Email"]) && !isset($_SESSION["msgShown"]))` – Indra Kumar S Jun 08 '21 at 15:42

0 Answers0