Hi all,

After spending 2 days going through this code, going through search engines and endless forums trying to find a solution, i find myself still on Square 1. Therefore just before I begin hitting my head against the wall (have pity on the poor wall) I thought I'd give this forum a go hoping that someone might be able to help me find what is wrong with this code:

Sincerely appreciate your time and assistance.

Thank you

The error message I receive is:
Parse error: syntax error, unexpected $end in /home/zincom/public_html/hf/contactformprocess.php on line 76

The code I have is:


if(isset($_POST['info@xxxxxxxxxx'])) {

    include 'contactformsettings.php';

    function died($error) {
        echo "Sorry, but there were error(s) found with the form you submitted. ";
        echo "These errors appear below.<br /><br />";
        echo $error."<br /><br />";
        echo "Please complete all fields.<br /><br />";

    if(!isset($_POST['Name']) ||
        !isset($_POST['Email']) ||
        !isset($_POST['Phone']) ||
        !isset($_POST['Enquiry']) || 
        ) {
        died('Sorry, there appears to be a problem with your form submission.');        

    $full_name = $_POST['Name']; // required
    $email_from = $_POST['Email']; // required
    $telephone = $_POST['Phone']; //  required
    $comments = $_POST['Enquiry']; // required
    $antispam = $_POST['AntiSpam']; // required

    $error_message = "";

    $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  if(preg_match($email_exp,$email_from)==0) {
    $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  if(strlen($name) < 2) {
    $error_message .= 'Please enter your name.<br />';

      if(strlen($phone) < 2) {
    $error_message .= 'Please enter your phone number.<br />';
  if(strlen($enquiry) < 2) {
    $error_message .= 'Please enter details of your enquiry.<br />';

  if($antispam <> $antispam_answer) {
    $error_message .= 'The Anti-Spam answer you entered is not correct.<br />';

  if(strlen($error_message) > 0) {
    $email_message = "Form details below.\r\n";

    function clean_string($string) {
      $bad = array("content-type","bcc:","to:","cc:");
      return str_replace($bad,"",$string);

    $email_message .= "Name: ".clean_string($name)."\r\n";
    $email_message .= "Email: ".clean_string($email_from)."\r\n";
    $email_message .= "Phone: ".clean_string($phone)."\r\n";
    $email_message .= "Enquiry: ".clean_string($enquiry)."\r\n";

$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
header("Location: $thankyou");
<script>location.replace('<?php echo $thankyou;?>')</script>
5 Years
Discussion Span
Last Post by |-|x

Just like the error says, you are missing an ending } to close off the first line of your code:

if(isset($_POST['info@xxxxxxxxxx'])) {

So right after line 75 just add an ending "}" curly bracket

Even the most basic editor should have made this pretty easy to find.

Edited by dschuett


thankyou dschuett for your swift response... really appreciate it.

Next problem now is that I am not receiving emails....argghhhhh....


It looks like you are not setting $email_to or $email_subject anywhere.

Check these, and verify if you can that your SMTP server is configured in the php.ini/conf file. You may need to set this via

ini_set ( "SMTP", "smtp-server.example.com" );
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.