Hey I've been working about a week on this script but I just can't seem to get it right. I'm trying to build an order form where users are presented with a list (drawn from a mysql relation) of available colors of paint shown in an HTML table. In every <tr> there is one <td> with an text input allowing users to choose their quantity. At the bottom of the form I'd like an add to cart button which stores the items (as well as session_id) into the 'cart' table in my database.
Some of the features I'm hoping for include:
Updating existing quantities if product is already in cart.
If one or more of the posted quantities is higher than the amount in stock, don't add anything to the cart and instead display the page again with an error message detailing which paints exceeded the available stock
If there are no errors display message that items have been added to cart
Some of my main issues include:
I have been doing everything from the same loop and I need to use the loop in areas that are not inside the table.. but as soon as I add another extract() or mysql_fetch_array things go crazy.
I'm not confident at all in what I'm doing
If anybody can help me it would be appreciated.. I've been pulling my hair out over this.