Reputation: 668
Fairly new to PHP, and I'm working on a simple form,
Users enter in their information and then once it's checked to see if the information is there and not empty, then use the mail function to send it out
here is the code
I get the error
Parse error: syntax error, unexpected ',' in C:\xampp\htdocs\registration.php on line 20
line 20 is where the mail function is
if (isset ($_POST['attendee']) && isset ($_POST['attending']) && isset ($_POST['message']) && isset ($_POST['contact_email']))
{
$attendee = $_POST['attendee'];
$attending = $_POST['attending'];
$contact_email = $_POST['contact_email'];
$message = $_POST['message'];
if(!empty($attendee) && !empty($attending) && !empty($message) && !empty ($contact_email))
{
$to = '[email protected]';
$subject = 'Wedding Information Received'.'attending';
$body = $message;
$headers = 'From: '.'contact_email';
if (@mail(($to,$subject, $body, $headers))){
echo 'Thanks for Reserving';
} else{
echo 'Sorry, an error occured. Please Try again later.';
}
}
else{
echo ' All Fields are Required';
}
}
Upvotes: 0
Views: 53
Reputation: 95161
You are using 2 ((
in front of mail
instead (
and 3 )))
instead of 2 ))
at the end ...
Replace
if (@mail(($to,$subject, $body, $headers))){
With
if (@mail($to,$subject, $body, $headers)){
Upvotes: 2