Schlo_50 Posted February 25, 2008 Share Posted February 25, 2008 Hey guys, I have some code which gathers information submitted from a form by users. The information is stored in an array separated by commas. I need to print out the data ($orderid and $quantity) stored in the array, but it needs to be exploded and displayed in two rows. At the moment when i print out the data a string separated by commas is displayed. Any help? if (isset($_POST['update']) && ($_POST['update']==="Review Order")) { $orderid = array(); $quantity = array(); $price = array(); foreach($_POST['orderid'] as $id){ $orderid[] = $id; $quantity[] = $_POST['quantity'][$id]; $price[] = $_POST['price'][$id]; $subtotals[] = $_POST['price'][$id] * $_POST['quantity'][$id]; $total += $_POST['price'][$id] * $_POST['quantity'][$id]; } $orderid = implode(',', $orderid); $quantity = implode(',', $quantity); $price = implode(',', $price); $_SESSION['Total'] = $total; $_SESSION['orderID'] = $orderid; $_SESSION['Quantity'] = $quantity; print "<br /><br /><table width=\"300\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\" class=\"main2\"> <tr> <td><strong>Order Id</strong></td> <td><strong>Quantity</strong></td> <td><strong>Individual Price (£)</strong></td> </tr> <tr> <td>$orderid</td> <td>$quantity</td> <td>$price</td> </tr> </table><br /><br />"; print "<span class=\"main2\">Total: £$total</span>"; Thanks for any help guys! Quote Link to comment Share on other sites More sharing options...
Schlo_50 Posted February 25, 2008 Author Share Posted February 25, 2008 bump Quote Link to comment Share on other sites More sharing options...
uniflare Posted February 25, 2008 Share Posted February 25, 2008 not exactly sure what your trying to do (im dumb ) but have you tried explode(",",$array); ? Quote Link to comment Share on other sites More sharing options...
Orio Posted February 25, 2008 Share Posted February 25, 2008 First of all, if you want it to be in an regular array, and not in a comma separated string, don't implode the arrays. I don't really understand what exactly you want to print in each row. Orio. 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.