添加密码到表单

I'm trying to create a form where the user is required to use a password that I give them. So when the user submits a form they will have to type "Password123" into the form before they can submit the form to my email. However, if they get the password wrong, the site will redirect to an error page.

So far, I keep getting an internal server error.

Here is the html:

    <form method="post" action="contactengine.php">
<div class="forms">
                <h4>PASWORD: <input type="password" placeholder="******" name="Password" /></h4>
                <h4>YOUR NAME: <input type="text" placeholder="Smith Family" name="Name" /></h4>
                <h4>YOUR CITY: <input type="text" placeholder="Anytown, USA"name="City" /></h4>
                <h4>YOUR TELLEPHONE: <input type="text" placeholder="123.456.7891"name="Tel" /></h4>
                <h4>YOUR EMAIL: <input type="text" placeholder="you@emaildomain.com" name="Email" /></h4>
                <h4>MESSAGE TO US:</h4> <textarea width="10000px" name="Message" placeholder="Go ahead and say something nice to us!" rows="20" cols="20" id="Message"></textarea>
                <br>

                <input type="submit" name="submit" value="Submit" class="submit-button" />
            </form>
</div>

This is the PHP:

<?php

$Password = Trim(stripslashes($_POST['Password']));
$EmailFrom = "me@gmail.com";
$EmailTo = "me@gmail.com";
$Subject = "THIS IS THE SUBJECT";
$Name = Trim(stripslashes($_POST['Name'])); 
$Tel = Trim(stripslashes($_POST['Tel'])); 
$Email = Trim(stripslashes($_POST['Email'])); 
$Message = Trim(stripslashes($_POST['Message'])); 
// THIS IS WHERE I AM STUCK
    if ($Password != "Password123") {
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
      exit;
    }


$validationOK=true;
if (!$validationOK) {
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
  exit;
}

$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "
";
$Body .= "Tel: ";
$Body .= $Tel;
$Body .= "
";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "
";
$Body .= "Message: ";
$Body .= $Message;
$Body .= "
";


$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");


if ($success){
  print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
}
else{
  print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>

May be you can try this ...

 if ($Password != "Password123") {
      echo "<script language='javascript'> window.location='error.htm'; </script>";
      exit;
    }
if ($Password != "Password123") {
echo "<script>document.location.href='new.php'</script>";
}

You may try this code,May be helpful to you.