Hi,

I have written code for a basket page. I am using Switch functions for:

add item - adds to basket and also checks if already in basket - if in basket already increases quantity.

remove item - button on basket page to delete that product from the basket.

update item - If a customer wants to change the quantity.

I have a problem with the update item. This is the code suggested to me:

PHP Code:
function UpdateItem($ID$quantity){

//It executes a simple UPDATE SQL query against the cart table, updating the quantity of one specific item. The cookieId //field is used to match the users session ID to that particular product, making sure that the quantity is only updated for //that item and the current user:


@mysql_query("update cart set quantity = quantity + '$quantity' where cookieid = '" GetCartId() . "' and productid = $ID"); 
I cannot get it to work. I thought I might need to use a form to submit the quantity that the user has entered into the 'quantity' box. If the new quantity entered into the box can be submitted using PHP then i would prefer that.

How do I use the quantity entered by the customer to get the quantity updated?!?

It might be that the code above is correct but I do not have the right code on the basket page to use that code. I have a text box on the basket page but I am not entirely sure how to initiate the code above.

Matt.