title: PHP if Statement for my simple login system not working as expected
body: <p>I've creatde a simple PHP login system, I am facing some problems with my code crosschecking the username and password. It isn't working as expected as the page is not moving me to the <code>management.php</code> page.</p>
  
  <p>I have managed to confirm a successful connection to the database. The query is also correct as I am able to echo the Database Query onto the page (early tests). However, now that I have moved forward and started inserting if statements to get some form of authentication going, the page does not redirect me anymore... Could someone please take a closer look?</p>
  
  <pre><code>&lt;?php
  session_start(); 
  if(isset($_POST['submit'])){
  $db = mysqli_connect("localhost","root","root","customer");
  if($db){
    $username = strip_tags($_POST['username']); 
    $password = strip_tags($_POST['password']); 
    $username = stripslashes($username); 
    $password = stripslashes($password); 
    $username = mysqli_real_escape_string($db,$_POST['username']); 
    $password = mysqli_real_escape_string($db,$_POST['password']); 
    $sql = "SELECT * FROM customers WHERE username='$username' AND password='$password';";
    $query = mysqli_query($db, $sql);
    $row = mysqli_fetch_array($query);
  
    }elseif($username == $row['username'] &amp;&amp; $password == $row['password']) {
      header("Location: management.php");
      echo $username;
    }else{
  
  
      die("Connection Failed" . mysqli_connect_error());
    }
  }
  ?&gt;
  </code></pre>
  
  <p>below is my form that should trigger my php code. everything should be working accordingly here.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form method="POST" action="index.php"&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;td&gt;username&lt;/td&gt;
      &lt;td&gt;&lt;input type="text" name="username" class="textinput"/&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;password&lt;/td&gt;
      &lt;td&gt;&lt;input type="password" name="password" class="textinput"/&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;input type="submit" value="submit" name="submit"/&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Please Criticise and help find where I am going wrong. </p>