Using syntax highlighting would have hinted at the problem
<?php
if ($mailsent) {
echo "Congratulations $contactname ! The following message has been sent to our specilist gearbox colection service: <br><br>";
echo "<span class="historydate">Name:</span> $contactname<br>";
echo "Order Number: $customerordernumber<br>";
echo "Phone Number: $phonenumber<br>";
echo "Fax Number: $faxnumber<br>";
echo "Model Number: $modelnumber<br>";
echo "Serial Number: $serialnumber<br>";
echo "Size:$size<br>";
echo "Weight: $weight<br>";
echo "Packaging: $packaging<br>";
echo "Number of Packages: $numberofpackages<br>";
echo "Required Delivery Date: $reqdeldate<br>";
echo "Handling Issues: $handlingissues<br>";
echo "gearbox Application: $gearboxapplication<br>";
echo "Failure Mode: $failuremode <br>";
} else {
echo "There was an error...";
}
}
And if heredoc was known of, then it wouldn't have taken much to find the relevant section of the manual, which would have not only explained how to use heredoc syntax, but also how to fix the original problem.
For a fourth solution, don't put everything inside echo statements; escape out of PHP and just output plain HTML, using PHP only for the bits that need it.
if ($mailsent) {
?>Congratulations <?php echo $contactname?> ! The following message has been sent to our specilist gearbox colection service: <br><br>
<span class="historydate">Name:</span> <?php echo $contactname?><br>
BLAH
<?php } else {
Ironically, there is no CSS here....