title: elseif not working message doesn't show
body: <p>`
  
  <pre><code>$username = mysqli_real_escape_string($connection, $_POST['username']);
  $password = mysqli_real_escape_string($connection, $_POST['password']);
  
  if (!preg_match("/^\w+$/",$username)) {
      $error = true;
      $username_error = "Username cant contain space and special characters";
  }
  if(strlen($password) &lt; 6) {
      $error = true;
      $password_error = "Password must be minimum of 6 characters";
  }
  
  $result = mysqli_query($connection, "SELECT * FROM users WHERE username = '" . $username. "' and password = '" . md5($password) . "'");
  
  if ($row = mysqli_fetch_array($result)) {
      $_SESSION['usr_id'] = $row['id'];
      $_SESSION['usr_name'] = $row['name'];
  if ($row['id'] == 1) {
      header("Location: priv8/ididthis.php");
  } else if ($row['id'] &gt;= 1) {
      header("Location: index.php");
  } else {
      $errormsg = "Incorrect username or Password!";
  }
  </code></pre>
  
  <p>can u see what's wrong with my code ? the <code>$errormsg</code> doesn't showing when the username or the password is wrong..</p>
  
  <p>`
    </p>
  
  <pre><code>&lt;body&gt;
  &lt;div class="layout"&gt;
      &lt;div class="layout-screen"&gt;
          &lt;div class="app-title"&gt;
              &lt;h1&gt;Login&lt;/h1&gt;
          &lt;/div&gt;
  
          &lt;div class="layout-form"&gt;
  
              &lt;form action="&lt;?php echo $_SERVER['PHP_SELF']; ?&gt;" method="POST"&gt;
  
              &lt;div class="control-group"&gt;
              &lt;input type="text" name="username" class="login-field" value="" placeholder="username" id="login-username"&gt;
              &lt;label class="login-field-icon fui-user" for="login-username"&gt;&lt;/label&gt;
              &lt;/div&gt;
  
              &lt;div class="control-group"&gt;
              &lt;span&gt;&lt;?php if (isset($username_error)) { echo $username_error; } ?&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;div class="control-group"&gt;
              &lt;input type="password" name="password" class="login-field" value="" placeholder="password" id="login-pass"&gt;
              &lt;label class="login-field-icon fui-lock" for="login-pass"&gt;&lt;/label&gt;
              &lt;/div&gt;
  
              &lt;div class="control-group"&gt;
              &lt;span&gt;&lt;?php if (isset($password_error)) { echo $password_error; } ?&gt;&lt;/span&gt;
              &lt;/div&gt;
  
              &lt;div class="control-group"&gt;
              &lt;input class="btn btn-primary btn-large btn-block" type="submit" name="login" value="Sign in"/&gt;
              &lt;/div&gt;
  
              &lt;/form&gt;
  
              &lt;span&gt;&lt;?php if (isset($errormsg)) { echo $errormsg; } ?&gt;&lt;/span&gt;
  
              &lt;a class="layout-link" href="forgot.php"&gt;Lost your password?&lt;/a&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><br>
    </p>