I am attempting to create a shopping cart using PHP for a Shirt Design Website. Users can design the shirts and then add them to the cart. So I created a form, in which users can pick their colour and sizes:
<form action="cart_main.php">
<table>
<tr><td>Colour:</td><td> <select>
<option value="Blue">Blue</option>
<option value="Red">Red</option>
<option value="Pink">Pink</option>
<option value="Black">Black</option>
<option value="Grey">Grey</option>
<option value="Beige">Beige</option>
<option value="White">White</option>
</select></td></tr>
<tr><td>Design:</td><td> <select>
<option value="T1">Skull</option>
<option value="T2">Liquify</option>
<option value="T3">Wings</option>
<option value="T4">Small Skull</option>
<option value="T5">Cogs</option>
<option value="T6">Safety Pin</option>
</select></td></tr>
<tr><td>Pop Colour: </td><td> <select>
<option value="Blue">Blue</option>
<option value="Red">Red</option>
<option value="Yellow">Yellow</option>
<option value="Purple">Purple</option>
</select></td></tr>
<tr><td><button id="addToCart" name="addToCart">Add to Cart</button></td></tr>
</table>
</form>
I need to simply create a shopping cart that will display all of the added items and total price when viewed by the user. This wouldn't be too hard, if it was a single value, but since I need to send/store 3 values; Colour, Design and Pop Colour, I am not sure how i should do it.
I have tried:
> Sending the selected data to a table in a database. And then getting the whole table when viewing the Cart
> Using javascript to Find the ID of a shirt depending of what has been selected (Failed)
So my QUESTION is:
How would i create a shopping cart for something like this in the simplest manner. Or how do i send multiple values accross and group them so i can create a cart.
Thank you Very Much!!