0

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';
    }
}   
1
  • 1
    Try changing @mail(($to,$subject, $body, $headers)) to just @mail($to,$subject, $body, $headers) Commented May 4, 2012 at 16:38

1 Answer 1

2

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)){
Sign up to request clarification or add additional context in comments.

1 Comment

thanks that was totally it, question though, I'm getting the error message right when I launch the page in localhost....ideas why?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.