I have the following. Im trying to send a table of data through to an email address but this code is not working I get the following error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING
Here is the processing code:
<?php
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-Type: text/html; charset=ISO-8859-1' . "
";
$headers .= "From: Sales Rep <darrenascas@casc.com>
";
$subject = 'Email report';
$to = 'domscinic.masccafee@emaccasre.com';
$subject = "Web Contact Data";
$body = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This email contains HTML Tags!</p>
<table border='1'>
<thead>
<tr>
<?php
if (!empty($_POST)) {
echo '<tbody>';
foreach($_POST['itemCode'] as $row => $item) {
echo'<tr>';
echo '<td>' . htmlspecialchars($_POST['itemCode'][$row]) . "" . "</td>";
echo '<td>' . htmlspecialchars($_POST['itemDesc'][$row]) . "" . "</td>";
echo '<td>' . htmlspecialchars($_POST['itemQty'][$row]) . "" . "</td>";
echo '<td>' . '€' . htmlspecialchars($_POST['itemPrice'][$row]) . "" . "</td> ";
echo '<td>' . '€' . htmlspecialchars($_POST['itemLineTotal'][$row]) . "" . "</td>";
echo'<tr>';
}
echo '</tbody>';
}
?>
</tr>
</thead>
</table>
</body>
</html>
";
$send = mail($to, $subject, $body, $headers);
if($send){
// header( "Location:index.php" );
} else {
print "We encountered an error sending your mail, please try again";
}
?>
Could someone please advise? I really need to get this working today. Please please someone help.