Skip to content Skip to sidebar Skip to footer

Php Shopping Cart Problem

Okay, so I have a shopping cart problem. I've decided to roll out my own cart, which is alot easier than I had expected. BUT, I've run into a problem and cannot for the life of me

Solution 1:

If I understand you correctly, you just need to add a input variable.

<tr><td>Cool Item</td><td><inputtype='text'name='items[<?=$product_id;?>]'value='1' /></td></tr>

Then check the $_POST['items'] array.

foreach($_POST['items'] as$product_ID=>$quanity) {
    proccessItem($product_ID, $quanity);
}

Solution 2:

You will need to use a form that post onto the page to change the values in the database. Another option would be to use an Ajax request if you do not want the page to reload on update.

I would say in this instance you would want add a remove from cart button and a onkeyup event to your quantity box that would then be handled through Ajax.

Solution 3:

Your question is not clear, but am answering because you appreciate any help. :-)

Are you using session.

create a session array for keep the selected items

when ever user edit his cart update thats session array.

show items from that array. at last when he check out post data into db from this session array.

i found an error on website

Warning: Invalid argument supplied for foreach() in E:\web\onestopf\checkout.php on line 55

Then on that row count now its 10,20,23. 10,20,30 will be better :-)

Post a Comment for "Php Shopping Cart Problem"