Login form not submitting properly in PHP
<p>I'm new to PHP and I have a login page with a form. I want to authenticate the user and then redirect the user to another page with the season values. When I submit the page is not redirecting and if a pres F5 the page will popup the resubmission message of the form. This is my code.</p>

<pre><code>&lt;?php
        session_start();
         include('../includes/header.php');
           $title="Login";

?&gt; 
&lt;?php  

        include('../includes/authenticate.php');
        include('../includes/dbschema.php');


        //if the user has not logged in
        if(!isLoggedIn())
        {

           if($_SERVER['REQUEST_METHOD']== 'POST'){

        //include('../includes/authenticate.php');

        $username = $_POST['username'];
        $password = $_POST['password'];

        //sanitize username
    $username = mysql_real_escape_string($username);

        if(isset($_POST['username']) &amp;&amp; isset($_POST['password'])){


        $query = "SELECT password, salt FROM user WHERE username = '$username';";

        $result = mysql_query($query);
        if(mysql_num_rows($result) &lt; 1) //no such user exists
        {
            header('login.php');
           $errmessage = "Invalid user";
           print "&lt;p id\"errmessage\"&gt; $errmessage &lt;/p&gt;";

        }

        $userData = mysql_fetch_array($result, MYSQL_ASSOC);
        $hash = hash('sha256', $userData['salt'] . hash('sha256', $password) );
        if($hash != $userData['password']) //incorrect password
        {
            header('login.php');


        }
        else
        {


            validateUser(); //sets the session data for this user

        }
        //redirect to another page or display "login success" message
         header('Location: actividades.php');

        }


        }
        else
        {
          $status = "logout";
           print  "&lt;p id=\"usernamelink\"&gt;Bienvenido,&lt;a id=\"usernamecolor\"&gt; " . $_SESSION['username'] . " &lt;/a&gt;&lt;/p&gt;";
          print  "&lt;a id=\"logoutlink\" href=\"../includes/logout.php   \"&gt;Log out&lt;/a&gt;";
          //page content follows
        }

          ?&gt;

        &lt;/br&gt;

          &lt;div id="logindiv"&gt;
                  &lt;?php   print "&lt;h1 id=\"logintitle\"&gt;Login&lt;/h1&gt;";?&gt;
                       &lt;form id="loginform" name="login" action="login.php" method="post" &gt;
            Username: &lt;input id="inplogin" type="text" name="username" /&gt;
                           &lt;br/&gt;&lt;br/&gt;
            Password: &lt;input id="inplogin" type="password" name="password" /&gt;
                    &lt;br/&gt;   


            &lt;input id="btnlogin" type="submit" value="Login" /&gt;
        &lt;/form&gt;
              &lt;/div&gt;

&lt;?php include('../includes/footer.php') ; ?&gt;
</code></pre>
