title: Login error message in modal
body: <p>I created a login modal form with username and password. Successful login will redirect to my admin dashboard. Is there a way I can put the error message "Username and Password is incorrect" when trying to login incorrect credentials below my login modal form?</p>
  
  <p>My modal form:</p>
  
  <pre><code>  &lt;li class="active"&gt;  &lt;a href="#" data-toggle="modal" data-target="#login-modal"&gt;Login&lt;/a&gt;&lt;/li&gt;
                    &lt;div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;"&gt;
            &lt;div class="modal-dialog"&gt;
                  &lt;div class="loginmodal-container"&gt;
                      &lt;h1&gt;Login&lt;/h1&gt;&lt;br&gt;
                    &lt;form action="" method="post" name="login"&gt;
                      &lt;input type="text" name="username" placeholder="Username" required&gt;
                      &lt;input type="password" name="password" placeholder="Password" required&gt;
                      &lt;input type="submit" name="submit" class="login loginmodal-submit" value="Login"&gt;
                    &lt;/form&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
            &lt;/div&gt;
  </code></pre>
  
  <p>Script:</p>
  
  <pre><code>&lt;?php
      require('db1.php');
      session_start();
      if (isset($_POST['username'])){
  
          $username = stripslashes($_REQUEST['username']);
          $username = mysqli_real_escape_string($con,$username); 
          $password = stripslashes($_REQUEST['password']);
          $password = mysqli_real_escape_string($con,$password);
  
          $query = "SELECT * FROM `users` WHERE username='$username' and password='".md5($password)."'";
          $result = mysqli_query($con,$query) or die(mysqli_error());
          $rows = mysqli_num_rows($result);
          if($rows==1){
              $_SESSION['username'] = $username;
              header("Location: view.php");
              }else{
                  echo "&lt;div class='login-modal'&gt;Username or password is incorrect.&lt;br/&gt;Click here to &lt;a href='index.php'&gt;Login&lt;/a&gt;&lt;/div&gt;";
                  }
      }else{
  ?&gt;
  </code></pre>