Hi All,
Hope you're well.
I'm trying to code a bit of PHP for my website, though I must say I'm rather new to the whole thing. I followed a YouTube clip the results of which you've no doubt come across before as it contained an open-line error that has caused a lot of people problems. However, I've taken this and used it to develop three of scripts, none of which works for me due to a parsing error:
Parse error: syntax error, unexpected T_VARIABLE [...] on line 38
Line 38 is
$theResults = <<<EOD
Here's the example of one of the codings, the solution to which will no doubt shed light on the other two.
<?php
/* Subject and e-mail variables */
$emailSubject = 'Customer Request: Ask a Question';
$webMaster = 'myemail@mydomain.co.uk';
/* Gsthering data variables */
$titleField = $_POST['title'];
$firstnameField = $_POST['first_name'];
$surnameField = $_POST['surname'];
$emailField = $_POST['email'];
$daytimetelField = $_POST['daytime_tel'];
$eveningtelField = $_POST['evening_tel'];
$marketingsourceField = $_POST['marketing_source'];
$messageField = $_POST['message'];
$termsandconditionsField = $_POST['terms_and_conditions'];
$body = <<<EOD
<br><hr><br>
<b>Title:</b> $titleField <br>
<b>First Name:</b> $firstnameField <br>
<b>Surname:</b> $surnameField <br><br>
<b>Daytime Telephone:</b> $daytimetelField <br>
<b>Evening Telephone:</b> $eveningtelField <br><br>
<b>Marketing Source:</b> $marketingsourceField <br>
<b>Accepts T&Cs:</b> $termsandconditionsField <br><br>
<b>Message:</b><br> $messageField
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);
/* Results rendered as HTML */
$theResults = <<<EOD
<html>
***Snip - this area contains the HTML code for the results which I've cut down for readability***
</html>
EOD;
echo $theResults;
?>
I'm absolutely stumped. I've checked for rogue spaces or lines not closed properly but can't find anything - your help would be most gratefully received.
Kind regards,
Max