Hi there.
I have built a basic html form with php mail handling and it works pretty well.
However, I was getting cocky and tried to create a quasi autoresponder and now the trouble has started!!
I have extended the mail() statement like so:
Previously it read:
and worked fine.
The error I am getting reads:
Parse error: parse error, unexpected T_BOOLEAN_AND in /home/websimpleuk/public_html/new/mail.php on line 79.
I have Googled the problem to no avail. Can you help please??
The full code is:
I have built a basic html form with php mail handling and it works pretty well.
However, I was getting cocky and tried to create a quasi autoresponder and now the trouble has started!!
I have extended the mail() statement like so:
Code:
elseif (mail($my_email,$subject,$message,'From: '.$email."\r\n"))&&(mail($email,$subject,$message,'From: '.$my_email."\r\n"))
Previously it read:
Code:
elseif (mail($my_email,$subject,$message,'From: '.$email."\r\n"))
The error I am getting reads:
Parse error: parse error, unexpected T_BOOLEAN_AND in /home/websimpleuk/public_html/new/mail.php on line 79.
I have Googled the problem to no avail. Can you help please??
The full code is:
Code:
<?php
$my_email = "info@websimple.co.uk";
/* All form fields are automatically passed to the PHP script through the array $HTTP_POST_VARS. */
$email = $HTTP_POST_VARS['email'];
$name = $HTTP_POST_VARS['name'];
$company = $HTTP_POST_VARS['company'];
$subject = $HTTP_POST_VARS['subject'];
$comments = $HTTP_POST_VARS['comments'];
$message = "Name: $name \n";
$message .= "E-mail: $email \n";
$message .= "Company: $company \n";
$message .= "Comments: $comments \n\n";
if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $email)) {
echo "<blockquote> <p>Sorry, the e-mail address you gave was invalid. Please re-enter email address.</p></blockquote> ";
echo "<blockquote><a href='javascript:history.back(1);'class='blackfoot'>Return to form.</a></blockquote> ";
} elseif ($message == "") {
echo "<blockquote> <p>Sorry, you have not left a message. Please add a message.</p></blockquote> ";
echo "<blockquote><a href='javascript:history.back(1);' class='blackfoot'>Return to form.</a></blockquote> ";
}
/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */
elseif (mail($my_email,$subject,$message,'From: '.$email."\r\n")) && (mail($email,$subject,$message,'From: '.$my_email."\r\n")){
echo "<blockquote> <p>Thank you for your interest. We will repond as soon as possible</p></blockquote> ";
} else {
echo "<blockquote><p>Sorry but due to an unforseen error we cannot send email to $email. <br><br>Please send your enquiry to info@websimple.co.uk using your usual e-mail application.</p></blockquote> ";
}
?>