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 .'">'; } ?> Quote Link to comment 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... Quote Link to comment 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! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.