title: PHP alert message
body: <p>I know the first thing everyone is going to say is that this has been posted hundreds of times; however, I have tried all the different methods people have suggested with still no luck... I am trying to get an alert message to popup if the login fails but for some reason the message does not want to appear. Here's what I have so far:</p>
  
  <pre><code>if($conn) {
      $result=sqlsrv_query($conn, "SELECT * FROM Operator
      WHERE Username='{$_POST['login']}'");
      $pass=sqlsrv_fetch_array($result);
      if($pass["Password"] === $_POST['password']) {
          session_start();
          $_SESSION['loggedin']=true;
          header("Location: home.php");
          exit;
      }
      else {
          header("Location: login.php");
          echo '&lt;script type="text/javascript"&gt;';
          echo 'alert("Password Invalid!")';
          echo '&lt;/script&gt;';
      }
  }
  sqlsrv_close($conn);
  </code></pre>
  
  <p>The php is working fine but for some reason I can't get the javascript to work. Any ideas?</p>