-1

Trying to get a form result emailed to us and have client get a thank you
email for posting a request on our website. It's been a very long 3 days non stop, not a programmer but have been reading and reading and learning everywhere.

Keep getting "syntax error, or end of the line unexpected errors." Got all the codes in a PHP verificator online and it also shows "end of the
line unexpected and syntax error."
Thanks a lot.

<html>
<?php

if($_POST["submit"]) {

$webmaster="info@limousinesworld.com";
$subject="Limousines Quote Request";
$subject_client="Thank you for your Request";

$headers = 'From: LimousinesWorld' . "\r\n" .
'Reply-To: info@limousinesworld.com' . "\r\n" .
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers  = 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; 'X- 
Mailer: PHP/';
$headers[] = "From: LimousinesWorld <info@limousinesworld.com>";      

$replyemail="info@limousinesworld.com";

$senderClient=$_POST['EMail'];

$Comments1 = $_REQUEST['Comments1'] ;
$Comments2 = $_REQUEST['Comments2'] ;
$Name = $_REQUEST['Name'] ;
$Company = $_REQUEST['Company'] ;
$Telephone = $_REQUEST['Telephone'] ;
$EMail = $_REQUEST['EMail'] ;
$When_need_limo = $_REQUEST['When_need_limo'] ;


$mailBody= "
    Comments1:          $Comments1  \n
    Comments2:          $Comments2  \n
    Name:               $Name  \n
    Company:            $Company  \n
    Telephone:          $Telephone  \n
    EMail:              $EMail  \n
    When_need_limo:     $When_need_limo  \n;

$mailBody_client= '
<html>
</head>
<body>
<p>&nbsp;</p>

<p><b>Thank you for your Limousine Quote Request on our website.

<p><b>We will get back to you with very soon with: Prices, Pictures,     
Equipment and Options.</b></p>

<p><b>Best regards,<br />
<br />
LimousinesWorld<br />

<p>&nbsp;</p>
</body>
</html>
';


mail($webmaster, $subject, $mailBody, $headers);

mail($senderClient, $subject_client, $mailBody_client, $headers);

}
?>



 </html>
Ced
  • 1
  • 2
  • You are missing two things here : 1. Add another double quote at the end of $mailBody just like @Gerton did. 2. Last { should be before closing php tag and not after it. – joy d Jun 22 '15 at 11:08

2 Answers2

1

switch

$mailBody= "
    Comments1:          $Comments1  \n
    Comments2:          $Comments2  \n
    Name:               $Name  \n
    Company:            $Company  \n
    Telephone:          $Telephone  \n
    EMail:              $EMail  \n
    When_need_limo:     $When_need_limo  \n;

and add another " at the end before ;

$mailBody= "
    Comments1:          $Comments1  \n
    Comments2:          $Comments2  \n
    Name:               $Name  \n
    Company:            $Company  \n
    Telephone:          $Telephone  \n
    EMail:              $EMail  \n
    When_need_limo:     $When_need_limo  \n";

should work

Gerton
  • 676
  • 3
  • 14
0

Replace

$mailBody= "
    Comments1:          $Comments1  \n
    Comments2:          $Comments2  \n
    Name:               $Name  \n
    Company:            $Company  \n
    Telephone:          $Telephone  \n
    EMail:              $EMail  \n
    When_need_limo:     $When_need_limo  \n;

$mailBody_client= '
<html>
</head>
<body>
<p>&nbsp;</p>

<p><b>Thank you for your Limousine Quote Request on our website.

<p><b>We will get back to you with very soon with: Prices, Pictures,     
Equipment and Options.</b></p>

<p><b>Best regards,<br />
<br />
LimousinesWorld<br />

<p>&nbsp;</p>
</body>
</html>
';


mail($webmaster, $subject, $mailBody, $headers);

mail($senderClient, $subject_client, $mailBody_client, $headers);


?>
}


 </html>

With:

$mailBody= "
    Comments1:          $Comments1  \n
    Comments2:          $Comments2  \n
    Name:               $Name  \n
    Company:            $Company  \n
    Telephone:          $Telephone  \n
    EMail:              $EMail  \n
    When_need_limo:     $When_need_limo  \n";

$mailBody_client= '
<html>
</head>
<body>
<p>&nbsp;</p>

<p><b>Thank you for your Limousine Quote Request on our website.

<p><b>We will get back to you with very soon with: Prices, Pictures,     
Equipment and Options.</b></p>

<p><b>Best regards,<br />
<br />
LimousinesWorld<br />

<p>&nbsp;</p>
</body>
</html>
';


mail($webmaster, $subject, $mailBody, $headers);

mail($senderClient, $subject_client, $mailBody_client, $headers);


?>
}


 </html>
Iffi
  • 608
  • 1
  • 7
  • 16