HanneSThEGreaT Posted October 10, 2011 Author Share Posted October 10, 2011 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 .'">'; } ?> Link to comment https://forums.phpfreaks.com/topic/248679-email-order-confirmation/page/2/#findComment-1277735 Share on other sites More sharing options...
HanneSThEGreaT Posted October 10, 2011 Author Share Posted October 10, 2011 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... Link to comment https://forums.phpfreaks.com/topic/248679-email-order-confirmation/page/2/#findComment-1277739 Share on other sites More sharing options...
HanneSThEGreaT Posted October 10, 2011 Author Share Posted October 10, 2011 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! Link to comment https://forums.phpfreaks.com/topic/248679-email-order-confirmation/page/2/#findComment-1277748 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.