lional Posted September 12, 2008 Share Posted September 12, 2008 Hi all, I need to send two arrays through on my shopping cart. One is for the quantity and the other is if each print is portrait or landscape. Is this possible Here is my code so far <td valign="top"> <font face="arial" size="2" color="white"><input type="text" size="3" name="product[$prod_id_out]" value="0"></td> <td valign="top"> <select name="or[$prod_id_out]"> <option value="Landscape">Landscape</option> <option value="Portrait">Portrait</option> </select> </td> <td><font face="arial" size="2" color="white"> $size_inch_out</td> <td><font face="arial" size="2" color="white">$size_mm_out</td> <td><font face="arial" size="2" color="white">$price_out</td> and my view cart is if (isset($_POST['submit'])) { foreach ($_POST['product'] as $key => $value) { if (($value == 0) AND (is_numeric($value))) { unset ($_SESSION['cart'][$key]); } elseif (is_numeric($value) AND ($value > 0)) { $_SESSION['cart'][$key] = $value; } } foreach ($_POST['or'] as $orkey => $orient) { $_SESSION['orient'][$orkey] = $orient; } } // check if the shopping cart is empty $empty = TRUE; if (isset($_SESSION['cart'])) { foreach($_SESSION['cart'] as $key => $value) { if (isset($value)) { $empty = FALSE; } } } // Display the cart if it is not empty if (!$empty) { include 'includes/conn_db.php'; // Retrieve all of the information for the products in the cart $query = 'SELECT * FROM products WHERE prod_id IN ('; foreach ($_SESSION['cart'] as $key => $value) { $query .= $key . ','; } $query = substr ($query, 0, -1) . ') ORDER BY size_mm ASC'; $result = mysql_query($query); Is this possible Link to comment https://forums.phpfreaks.com/topic/123885-shopping-cart/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.