title: Text posted by 'echo' function still persists when refresh button is pressed.-- PHP
body: <pre><code>&lt;?php
      session_start();
      $root = 'root';
      mysql_connect('localhost',$root,'') or die(mysql_error()); 
      mysql_select_db("test_create_database") or die(mysql_error()); 
  
      $result = mysql_query("SELECT * FROM members");
      $row = mysql_fetch_assoc($result);
  
  
      $username="";
      $password="";
      $id="";
  
      if(isset($_POST["submit"]))
      {
          if(isset($_POST["submit"]) &amp;&amp; !empty($_POST["username"]) &amp;&amp; !empty($_POST["password"]) &amp;&amp; !empty($_POST["id"]))
          {
              if(isset($_POST["username"]) &amp;&amp; isset($_POST["password"]) &amp;&amp; isset($_POST["id"]))
              {   $username = $row["username"];
                  $password = $row["password"];
                  $id       = $row["id"];
                  if($username == "John" &amp;&amp; $password =="1234" &amp;&amp; $id =="1")
                  {
                      echo "you're in";
                  }
                  else
                  {
                      echo "you're out!";
                  }
              }
          }
          elseif (isset($_POST["submit"]) &amp;&amp; (empty($_POST["username"]) || empty($_POST["password"]) || empty($_POST["id"])))
          {
                  echo "enter all fields please!!!!";
          }
  
      }
      session_destroy();
  ?&gt;
  </code></pre>
  
  <p>if at first all the fields are filled in correctly and the submit button is pressed, the text "you're in" is printed onto the webpage and the text in the fields disappears. but if I refresh the page again, the printed text "you're in" still remains even though I have invoked the session_destroy() function. I don't understand why the session has not been destroyed. Any  help would be appreciated.</p>