Jump to content

shopping cart


lional

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.