title: Webpage refreshes to top on incorrect form submission
body: <p>If I enter an Incorrect email address or password my site refreshes to the top of the page and I see this error </p>
  
  <pre><code>Incorrect email and Pass 
  </code></pre>
  
  <p>I have to scroll back down to where my form is to see a detailed error.</p>
  
  <p>I want to prevent my page going to the top. </p>
  
  <p>I have searched for a solution on here but can't find anything.</p>
  
  <p>HTML Code:</p>
  
  <pre><code>&lt;body&gt;
  
      &lt;form method="post" style="margin-right:450px;"&gt;
          &lt;table align="center" cellspacing="3px;"&gt;
  
              &lt;tr&gt;
                  &lt;td&gt;
                      &lt;input style="border:1px #666 solid; border-radius: 4px; width: 180px; padding: 12px 20px; font-size:18px;" type="email" name="mail" required placeholder="Your Email"&gt;
                  &lt;/td&gt;
  
                  &lt;td&gt;
                      &lt;input style="border:1px #666 solid; border-radius: 4px; width: 180px; padding: 12px 20px; font-size:18px;" type="password" name="pass" required placeholder="Your Password"&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
  
          &lt;/table&gt;
  
          &lt;br&gt;&lt;br&gt;
  
          &lt;button class="button button3" type="submit" name="log" style="color:#FFF; text-align:center; margin-left:70px;"&gt;Log In&lt;/button&gt;&lt;/td&gt;
  
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>PHP Code:</p>
  
  <pre><code>&lt;?php
  
      $con=mysqli_connect("localhost","root","","form_data");
  
      if(isset($_POST['log']))
  
      {
          $_SESSION['mail'] = $_POST['mail'];
  
          $email = $_POST['mail'];
  
          $Password = $_POST['pass'];
  
          $query = mysqli_query($con,"select * from registration where (User_name = '$email' or Email= '$email') and Password = '$Password' ");
  
          $check = mysqli_num_rows($query);   
  
          if($check == 1)
          {
  
              echo "&lt;h1&gt; User Login &lt;h1&gt;";
  
              header("location:exam.php");
          }
          else
          {
              echo "&lt;div class='error'&gt; ";
              echo "!! Invalid Username Or Password !!";
              echo "&lt;/div&gt;";
  
          }
      }
  
  ?&gt;
  </code></pre>