Jump to content

Email Order Confirmation


HanneSThEGreaT

Recommended Posts

I tried this as well :

 

if (isset($_POST['ordered'])) {
// We can assign $_POST['product'] to a variable to make it easier to type out
$prod = $_POST['product'];
// Throw a little intro to see how many they checked
echo 'You selected ' , count($_POST['ordered']) , ' products.';
// Now we loop through it and get the IDS that were selected
// Foreach lets you select the $key and the $value for each iteration of the loop //
foreach ($_POST['ordered'] as $key=>$id) {
	echo '<p/>
	ProdName: ' , $prod[$id]['name'] , '<br/>
	ProdPrice: ' , $prod[$id]['price'] , '<br/>
	ProdQty: ' , $prod[$id]['qty'] , '
	<hr/>';


	$TOT += $prod[$id]['price'] * $prod[$id]['qty'];


}

	$TOT2 = $TOT + 55;

	$data=serialize($_POST['ordered']); 
		$encoded=htmlentities($data);
		echo '<input type="hidden" name="order" value="'.$encoded.'">';

	echo	'<input type="hidden" value ="'. $TOT .'">';
	echo	'<input type="hidden" value =". $TOT2 .'">';
}


?>

Aha! This seems to work on order.php :

 

      echo '<input type="hidden" name="'.$prod[$id]['name'].'" value="'.$prod[$id]['name'].'">';

      echo '<input type="hidden" name="'.$prod[$id]['price'].'" value="'.$prod[$id]['price'].'">';
      
      echo '<input type="hidden" name="'.$prod[$id]['qty'].'" value="'.$prod[$id]['qty'].'">';

 

Now on orderform.php, should I just loop through this array again? let me try that...

I tried this now ( a bit more optimised ) :

 

		$strOrder .= "<p/>ProdName: " . $prod[$id]['name'] . "<br/>ProdPrice: " . $prod[$id]['price'] . "<br/>ProdQty: " . $prod[$id]['qty'] . "<hr/>";

//     echo '<input type="hidden" name="'.$prod[$id]['name'].'" value="'.$prod[$id]['name'].'">';

//     echo '<input type="hidden" name="'.$prod[$id]['price'].'" value="'.$prod[$id]['price'].'">';
      
//      echo '<input type="hidden" name="'.$prod[$id]['qty'].'" value="'.$prod[$id]['qty'].'">';

	$TOT += $prod[$id]['price'] * $prod[$id]['qty'];


}

	$TOT2 = $TOT + 55;

	echo	'<input type="hidden" Name="TOT" value ="'. $TOT .'">';
	echo	'<input type="hidden" name="TOT2" value =". $TOT2 .'">';

	echo 	'<input type="hidden" name="Order" value=". $strOrder . '">';

 

and on orderform.php I included the same logic as was in the email. But now my order.php doesn't show anything!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.