I am currently setting up a html form that will allow the user to enter there information. When they hit the submit button I would like for the form to be sent to my e-mail address, a copy of it sent to the user e-mail address and for a thank you window to pop up. I have entered the code that I think is correct but when I pull up a browser to display the form part of the PHP code is showing at the bottom. Would really appriciate it if someone could take a look at this and give me any feed back of what I am doing wrong.
<?php
// get posted data into local variables
$Company = Trim($_POST[CompanyName]);
$Commodity = Trim($_POST[Commodity]);
$Tonnage = Trim($_POST[ExpectedTonnage]);
$Inbound = Trim($_POST[Inbound]);
$Outbound = Trim($_POST[Outbound]);
$RailService = Trim($_POST[RailService]);
$TruckingRate = Trim($_POST[TruckingRate]);
$SpecialRequirements = Trim($_POST[SpecialRequirements]);
$Storage = Trim($_POST[Storage]);
$Name = Trim($_POST[ContactName]);
$EmailFrom = Trim($_POST[EmailFrom]);
$Phone = Trim($_POST[PhoneNumber]);
$Fax = Trim($_POST[FaxNumber]);
$Confirmation = TRIM($_POST[Confirmation]);
$EmailTo = "myemail@mycompany.com>";
// error messages
if (Trim($CompanyName)=="")
{exit("Please enter your Company Name.");}
if (Trim($Commodity)=="")
{exit("Please enter the Commodity you would like quoted on.");}
if (Trim($ExpectedTonnage)=="")
{exit("Please enter the Expected Tonnage that you would like quoted on.");}
if (Trim($ContactName)=="")
{exit("Please enter your Name.");}
if (Trim($EmailFrom)=="")
{exit("Please enter your E-mail address.");}
if (Trim($PhoneNumber)=="")
{exit("Please enter your Phone number.");}
if (Trim(FaxNumber)=="")
{exit("Please enter your Fax number.");}
// prepare email body text
$Body .= "Rate Quote needed.\n";
$Body .= "message sent from email form.\n";
$Body .= "$CompanyName";
$Body .= "$Commodity";
$Body .= "$ExpectedTonnage";
$Body .= "$Inbound";
$Body .= "$Outbound";
$Body .= "$RailService";
$Body .= "$TruckingRate";
$Body .= "$SpecialRequirements";
$Body .= "$Storage";
$Body .= "$Contact Name";
$Body .= "$EmailFrom";
$Body .= "$PhoneNumber";
$Body .= "$FaxNumber";
$Body .= "$Confirmation";
// send email
$sendemail = mail($EmailTo, $Body, "From: $ContactName <$EmailFrom>");
// redirect to thank you page
if ($sendemail){print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.htm\">"; }
else{print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";}
// send copy of email to visitor
mail("$ContactName <$EmailFrom>", "We have recieved your message ",
"From: <myemail@mycompany>");
?>
</body>
</html>
This is the part that is showing up at the end of the form page when pulled up in a browser.
"; } else{print "";} // send copy of email to visitor mail("$ContactName <$EmailFrom>", "Armstrong Terminal has received your message ", "From: "); ?>
Any help would be greatly appriciated!!!