title: Add error message to PHP login page
body: <p>I am new to PHP, so please be gentle...</p>
  
  <p>I have created a PHP login page in Dreamweaver, and have set the failed login to return to the same page, but would like to display a message to say "username or password are incorrect".</p>
  
  <p>The data is stored in a MySQL database
  Here is the code that has been generated by Dreamweaver:</p>
  
  <pre><code>if (!isset($_SESSION)) {
    session_start();
  }
  
  $loginFormAction = $_SERVER['PHP_SELF'];
  if (isset($_GET['accesscheck'])) {
    $_SESSION['PrevUrl'] = $_GET['accesscheck'];
  }
  
  if (isset($_POST['email'])) {
    $loginUsername=$_POST['email'];
    $password=$_POST['password'];
    $MM_fldUserAuthorization = "";
    $MM_redirectLoginSuccess = "bac123_update_details.php";
    $MM_redirectLoginFailed = "bac123.php";
    $MM_redirecttoReferrer = true;
    mysql_select_db($database_connRespond, $connRespond);
  
    $LoginRS__query=sprintf("SELECT email, password FROM customer WHERE email=%s AND password=%s",
      GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
  
    $LoginRS = mysql_query($LoginRS__query, $connRespond) or die(mysql_error());
    $loginFoundUser = mysql_num_rows($LoginRS);
    if ($loginFoundUser) {
       $loginStrGroup = "";
      if (PHP_VERSION &gt;= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
      //declare two session variables and assign them
      $_SESSION['MM_Username'] = $loginUsername;
      $_SESSION['MM_UserGroup'] = $loginStrGroup;       
  
      if (isset($_SESSION['PrevUrl']) &amp;&amp; true) {
        $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];  
      }
      header("Location: " . $MM_redirectLoginSuccess );
    }
    else {
      header("Location: ". $MM_redirectLoginFailed );
    }
  }
  </code></pre>