Hello everyone and thanks in advance for your help. I'm making a web page with an order form. So far I have Javascript calculating the total of the order as the user clicks another text field box and then they proceed to the contact information part of the form. The customer uses text fields to order X amount of the particular items.

The part I'm not confident in making the PHP part so that both my email, the confirmation email and the "thank you for ordering page" all show only what they ordered along with their contact information. My code is posted below:

<?php
/* subject and email */

	$emailSubject = 'Your Order';
	$to = 'myemail@hotmail.com';
	
/* gathering data variables */

	$name = $_POST['name'];
	$phone = $_POST['phone'];
	$email = $_POST['email'];
	$month = $_POST['delivery_month'];
	$date = $_POST['delivery_date'];
	$year = $_POST['delivery_year'];
	$hour = $_POST['delivery_hour'];
	$minute = $_POST['delivery_minute'];
	$meridian = $_POST['am_pm'];
	$address = $_POST['street_address_1'];
	$addressTwo = $_POST['street_address_2'];
	$city = $_POST['city'];
	$state = $_POST['state'];
	$zip = $_POST['zip_code'];
	$comment = $_POST['comment'];
	$chocolate = $_POST['PROD_chocolate'];
	$doubleChocolate = $_POST['PROD_double_chocolate'];
	$tripleChocolate = $_POST['PROD_triple_chocolate'];
	$chocolateNut = $_POST['PROD_chocolate_nut'];
	$turtle = $_POST['PROD_turtle'];
$TOTAL = $_POST['total'];

	$body = <<<EOD
<br><hr><br>
Email: $email <br>
Name: $name <br>
Phone Number: $number <br>
Delivery Date: $month, $date, $year <br>
Delivery Time: $hour, $minute, $meridian <br>
Address: $address, $addressTwo<br>
City: $city<br>
State: $state<br>
Zip: $zip<br>
Special Instructions: $comment <br>
EOD;

	$headers = "From: $email\r\n";
	$headers .= "Content-type: text/html\r\n";
	$success = mail($to, $emailSubject, $body, $headers);
	$confirmation = mail($email,$emailSubject,$body);
	
	/* Results render as HTML */
	
	$results = <<<EOD
<html>
<head>
<title>Your Order Confirmation</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
	background-color: #f8d3e1;
	font-family:Geneva, Arial, Helvetica, sans-serif;
	font-size: 14px;
	font-style: normal;
	line-height: normal;
	font-weight: normal;
	color: #89304B;
	text-decoration: none;
}
-->
</style>
</head>

<div>
  <div align="center">Thank you for your order! A confirmation will be sent to the email provided momentarily.</div>
</div>
</body>
</html>
EOD;
echo "$results";

?>

Hi, please tell us what's wrong with the code, or what do you want from us.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.