I have HTML form which I use together with PHP. Just before the email gets sent, I want the form to be validated by PHP. This is my PHP code:
<?php
    $name = $_POST['yourName'];
    $email = $_POST['yourMail'];
    $message = $_POST['yourMessage'];
    $to = "blablabla@gmail.com";
    $subject = "New mail from bla-bla.org";
    $body = "From: $name\n E-Mail: $email\n Message:\n $message";
    if ($_SERVER['REQUEST_METHOD']== "POST") {
   $valid = true;
   if (empty($_POST["yourName"])) {
      $firstNameErr = "First name is required";
      $valid = false; //false
   }
   else {
      $firstName = test_input($_POST["yourName"]);
   }
   if (empty($_POST["yourMail"])) {
      $lastNameErr = "Last name is required";
      $valid = false;
   }
   else {
      $lastName = test_input($_POST["yourMail"]);
   }
   if (mail($to, $subject, $body)) {
        header("Location: http://www.blabla.org/contact.html");
    }
?>
After I click the Send button, I get this line in my browser:
Parse error: syntax error, unexpected end of file in /home/website/public_html/acknowledge.php on line 32
I went through my code over and over again, and cannot seem to find any mistake. Any suggestions or fresh pair of eyes that could suggest what is wrong?
EDIT: The parsing error is solved because of missing }. But, empty e-mails are still being sent without actual validation from PHP.
 
    