php to email not displaying input data

hi
i am relatively new to php. i am having very small troubles with an internal small business webpage i have put together for ordering. i have the html page where user enters their details and order. then i have the php which displays the order and confirmation, and also emails, in html the details and order. the php page displays everything correctly, but the email only displays the template and none of the user entered data. i am sure that there are mistakes in the codng which are not perfect, but as i said, it is for internal use. also, i can not work out why the email is coming from the web host server, and not the one i have in the code. any help would be greatly appreciated.
[php]

your order has been transmitted <?php if(isset($_POST['email'])) { // CHANGE THE TWO LINES BELOW function died($error) { // your error code can go here echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.

"; echo $error."

"; echo "Please go back and fix these errors.

"; die(); } // validation expected data exists if(!isset($_POST['store']) || !isset($_POST['contact']) || !isset($_POST['email']) || !isset($_POST['telephone']) || !isset($_POST['date']) || !isset($_POST['i2']) || !isset($_POST['i5']) || !isset($_POST['i11']) || !isset($_POST['i12']) || !isset($_POST['i13']) || !isset($_POST['i14']) || !isset($_POST['i66']) || !isset($_POST['i80']) || !isset($_POST['i81']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $store = $_POST['store']; // required $contact = $_POST['contact']; // required $email_from = $_POST['email']; // required $telephone = $_POST['telephone']; // required $date = $_POST['date']; // required $i2 = $_POST['i2']; // not required $i5 = $_POST['i5']; // not required $i11 = $_POST['i11']; // not required $i12 = $_POST['i12']; // not required $i13 = $_POST['i13']; // not required $i14 = $_POST['i14']; // not required $i66 = $_POST['i66']; // not required $i80 = $_POST['i80']; // not required $i81 = $_POST['i81']; // not required $comments = $_POST['comments']; // not required $error_message = ""; $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/'; if(!preg_match($email_exp,$email_from)) { $error_message .= 'The Email Address you entered does not appear to be valid.
'; } $string_exp = "/^[A-Za-z .'-]+$/"; if(!preg_match($string_exp,$store)) { $error_message .= 'The Store Name you entered does not appear to be valid.
'; } if(!preg_match($string_exp,$contact)) { $error_message .= 'The Last Name you entered does not appear to be valid.
'; } if(strlen($error_message) > 0) { died($error_message); } function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } $email_to = "$email_from, [email protected]"; $email_subject = "Country Valley order for " .clean_string($store). " For Delivery ".clean_string($date)."\n"; $email_message = ' Order details below.;
Store <?php $store; ?>
</td>
		
</tr>	

<tr align="top">
	
<td valign="top">

		
</td>
	
</tr>

<tr align="top">
	
<td valign="top">

		
Contact Person<br>
	
</td>
	
<td>
		
<?php echo  $_POST["contact"];?><br>
	
</td>

</tr>

<tr align="top">
	
<td valign="top">

		
Email Address<br>
	
</td>
	
<td>
		
<?php echo $_POST["email"]; ?><br>
	
</td>

</tr>

<tr align="top">
	
<td valign="top">

		
Telephone Number<br>
	
</td>
	
<td>
		
<?php echo $_POST["telephone"];?><br>
	
</td>

</tr>

<tr align="top">
	
<td valign="top">

		
Delivery Date<br>
	
</td>
	
<td>
		
<?php echo $_POST["date"];  ?><br>
	
</td>
	
</tr>

</div>

</table><P><P>

<tr align="top">		
	
<th align="left">

Description

<th align="center">

Quantity

<th align="left">

Item Code

</th>
	
</tr>


<tr>
	
<td valign="top" align="left">

2l Classic Full Cream

<td  align="center">
		
<?php echo $_POST["i2"]; ?><br></td>
	
<td  align="left">

2

</tr>
	
<tr>
	
<td valign="top" align="left">2l Classic Lite
<td  align="center">
		
<?php echo $_POST["i5"]; ?><br>
	
</td>
	
<td  align="left">

5

</tr>

<tr>
	
<td valign="top" align="left">1l Organic Full Cream
<td  align="center">
		
<?php echo $_POST["i11"]; ?><br>
	
</td>
	
<td  align="left">

11

</tr>

<tr>
	
<td valign="top" align="left">2l Organic Full Cream
<td  align="center">
		
<?php echo $_POST["i12"]; ?><br>
	
</td>
	
<td  align="left">12</td>

</tr>
	
<tr>
	
<td valign="top" align="left">1l Organic Lite</td>
	
<td  align="center">
		
<?php echo $_POST["i13"]; ?><br>
	
</td>
	
<td  align="left">

13

</tr>

<tr>
	
<td valign="top" align="left">2l Organic Lite</td>
		
<td  align="center">
		
<?php echo $_POST["i14"]; ?><br>
	
</td>
	
<td  align="left">

14

</tr>
	<tr>
	
<td valign="top" align="left">300ml Fresh Cream
<td  align="center">
		
<?php echo $_POST["i66"]; ?><br>
	
</td>
	
<td  align="left">

66

</tr>

<tr>
	
<td valign="top" align="left">500gm Lush Natural Yoghurt
<td  align="center">
			
<?php echo $_POST["i80"]; ?><br>
	
</td>
	
<td  align="left">

80

</tr>

<tr>
	
<td valign="top" align="left">500gm Lush Plain Yoghurt
<td  align="center">
		
<?php echo $_POST["i81"]; ?><br>
	
</td>
	
<td valign="top" align="left">81
</tr>


<tr>
	
<td valign="top" align="left">
<td  align="center">
		
	
</td>
	
<td valign="top" align="left">
</tr>

<br>
	
</td>	
</tr>

</div>
';

$headers = “From: O’connor IGA [email protected]\r\n”;
$headers = ‘MIME-Version:1.0’ . “\r\n”;
$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . “\r\n”;
$email_from."\r\n".
'Reply-To: '.

$email_from."\r\n" .
‘X-Mailer: php/’ . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);

?>

Thank you for your order which is shown below.



<table width="300px" align="center">

<div align="center">
	
<tr align="top">
		
<td valign="top">


<?php echo "Store:  ";  ?><br>
		
</td>
		
<td colspan="5">
<?php echo $_POST["store"]; ?>
	
</td>

</tr>

<tr align="top">
	
<td valign="top">

		
</td>
	
</tr>

<tr align="top">
	
<td valign="top">

		
<?php echo "Contact Person:  ";  ?><br>
	
</td>
	
<td>
		
<?php echo  $_POST['contact'];?><br>
	
</td>

</tr>

<tr align="top">
	
<td valign="top">

		
<?php echo "Email Address  ";  ?><br>
	
</td>
	
<td>
		
<?php echo  $_POST['email']; ?><br>
	
</td>

</tr>

<tr align="top">
	
<td valign="top">

		
<?php echo "Telephone Number  ";  ?><br>
	
</td>
	
<td>
		
<?php echo  $_POST['telephone'];?><br>
	
</td>

</tr>

<tr align="top">
	
<td valign="top">

		
<?php echo "Delivery Date  ";  ?><br>
	
</td>
	
<td>
		
<?php echo  $_POST['date'];  ?><br>
	
</td>
	
</tr>

</div>

</table><P><P>
<div align="center">

<tr align="top">		
	
<th align="left">

Description

<th align="center">

Quantity

<th align="left">

Item Code

</th>
	
</tr>


<tr>
	
<td valign="top" align="left">

2l Classic Full Cream

<td  align="center">
		
<?php echo  $_POST['i2']; ?><br>
	
</td>
	
<td  align="left">

2

</tr>
	
<tr>
	
<td valign="top" align="left">2l Classic Lite
<td  align="center">
		
<?php echo  $_POST['i5']; ?><br>
	
</td>
	
<td  align="left">

5

</tr>

<tr>
	
<td valign="top" align="left">1l Organic Full Cream
<td  align="center">
		
<?php echo  $_POST['i11']; ?><br>
	
</td>
	
<td  align="left">

11

</tr>

<tr>
	
<td valign="top" align="left">2l Organic Full Cream
<td  align="center">
		
<?php echo  $_POST['i12']; ?><br>
	
</td>
	
<td  align="left">12</td>

</tr>
	
<tr>
	
<td valign="top" align="left">1l Organic Lite</td>
	
<td  align="center">
		
<?php echo  $_POST['i13']; ?><br>
	
</td>
	
<td  align="left">

13

</tr>

<tr>
	
<td valign="top" align="left">2l Organic Lite</td>
		
<td  align="center">
		
<?php echo  $_POST['i14']; ?><br>
	
</td>
	
<td  align="left">

14

</tr>
	<tr>
	
<td valign="top" align="left">300ml Fresh Cream
<td  align="center">
		
<?php echo  $_POST['i66']; ?><br>
	
</td>
	
<td  align="left">

66

</tr>

<tr>
	
<td valign="top" align="left">500gm Lush Natural Yoghurt
<td  align="center">
			
<?php echo  $_POST['i80']; ?><br>
	
</td>
	
<td  align="left">

80

</tr>

<tr>
	
<td valign="top" align="left">500gm Lush Plain Yoghurt
<td  align="center">
		
<?php echo  $_POST['i81']; ?><br>
	
</td>
	
<td  align="left">81
</tr>

<br>
	
</td>	
</tr>

</div>
<?php } die(); ?>

[/php]
thanks in advance

Hi all, i found the fix for it… line 207, and every other varible, shoud be
‘.$store.’ (single quotes included) and not <?php $store; ?>
or <?php echo $_POST["store"];?>

thanks everyone who viewed. i really hope this helps others!

Sponsor our Newsletter | Privacy Policy | Terms of Service