title: Why POST['submit'] is set when I reload?
body: <p>My application is a simple login page. When it fails, I print an error message. My question is, why when I reload the page the message is been printed again? How can I fix that?
  The code is working fine, I've made another php file executing the database check &amp; connection.</p>
  
  <pre><code>&lt;?php 
  require_once("include/database.php");       
  if(isset($_POST['submit'])) {
      connect_bookstore(); // custom function
      $spassword = sha1($_POST['password']);
      $username = $_POST['username'];
      if ( checkpassword($username,$spassword) ) { //custom function
          header('Location:insert.php');
          exit;
      } else { 
          $message = "Login failed!";         
      }
  }   
  ?&gt;
  </code></pre>
  
  <p>Inside the html body.</p>
  
  <pre><code>&lt;?php 
  if (isset($message)) {
      echo $message;
  }
  ?&gt;
  </code></pre>