title: Redirected instantly to index without logging in validation
body: <p>I've tried creating a login page, but the what ever I put into the text fields  and hit the <code>login</code> button, it automatically redirects itself to the index page when it should notify the user <code>wrong username/passowrd</code>; Why is that?</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;div&gt;
      &lt;form method="post" action="customer_login.php"&gt;
          &lt;table width='500' align='center' bgcolor='skyblue'&gt;
              &lt;tr align='center'&gt;
                  &lt;td colspan ='4'&gt;&lt;h2&gt;Login/Register to Proceed&lt;/h2&gt;&lt;/td&gt;
              &lt;/tr&gt;   
  
              &lt;tr&gt;
                  &lt;td align='right'&gt;&lt;b&gt;Email:&lt;/b&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input type='text' placeholder='Enter Email' name='c_email'/&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td align='right'&gt;&lt;b&gt;Password:&lt;/b&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;input type='password' name='pass' placeholder="Enter Password"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr align='center'&gt;
                  &lt;td colspan='4'&gt;&lt;input type='submit'  value="Login" name="login"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
              &lt;h2 style=' float:center;padding:10px;'&gt;&lt;a href='customer_register.php' style='text-decoration:none;'&gt; Don't have an account?&lt;/a&gt;&lt;/h2&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  
  &lt;?php
      if(isset($_POST['login'])){
      include("includes/db.php");
      $username = strip_tags($_POST['c_email']);
      $password = strip_tags($_POST['pass']);
  
      $username = stripslashes($username);
      $password = stripslashes($password);
  
      $username = mysqli_real_escape_string($username);
      $password = mysqli_real_escape_string($password);
  
      $sql = "select * from customer where customer_email ='$username' LIMIT 1";
      $query_login = mysqli_query($con, $sql);
      $row = mysqli_fetch_array($query_login);
      $email = $row['customer_email'];
      $db_pass = $row['customer_pass'];
  
      if($password==$db_pass){
          $_SESSION['customer_email'] = $email;
          header("Location:index.php");
      }else{
          echo "&lt;h2 style='color:red;'&gt;Wrong Email/Password!&lt;/h2&gt;";
      }
          }
  ?&gt;  
  </code></pre>
  
  <p>I've already start the session somewhere in index.php. This is an e-commerce website where the user can add items to the cart even without logging in but should log in during checkout.</p>