I'm building a simple order system and want to send an email after the form is submitted. My PHP code looks similar to this:
$name=$_POST["orderName"];
$company=$_POST["orderCompany"];
$email=$_POST["orderEmail"];
$phone=$_POST["orderPhone"];
$headers = "From: $email\r\n" .
$item1=$_POST["orderItem1"];
$qty1=$_POST["orderQty1"];
$item2=$_POST["orderItem2"];
$qty2=$_POST["orderQty2"];
$item3=$_POST["orderItem3"];
$qty3=$_POST["orderQty3"];
$date = date("l, F j Y, G:i") ;
$message="Message sent: $date \n\n
Name: $name\n
Company: $company\n
Email: $email\n
Phone: $phone\n\n
Order:\n
$item1 \tx$qty1\n
$item2 \tx$qty2\n
$item3 \tx$qty3\n";
mail("[email protected]", "Order", $message, $headers);
That works fine, except in the body of the email I get the value of $item1 string at the very beginning, before the "Message sent..." - just like I added it to the $message (which I don't as far as I can see).