I’m having troubles getting my head around how to do this…
I have a website that sells tshirts. Basically you can buy the different styles in different colours and sizes.
In my form I have the item number, item name etc however I need to work out how to do the colour, size and qty all in one go.
Imagine the item is a short sleeve shirt and you can buy black, white, red, blue and yellow in S, M, L and XL and you can buy as many as you want in one go.
So I have this big form/table that looks like this: (the 0’s are text boxes)
S M L XL
Black 0 0 0 0
White 0 0 0 0
Red 0 0 0 0
Blue 0 0 0 0
Yellow 0 0 0 0
Someone can order say 5 Black S, 3 Red M, 4 Blue L and so on in one go and then click add to cart. The adding to the cart part I’m all good with if I can pass al the information over.
So my question is how would I go about passing in the information to my code to update the database.
Currently I just have <input type=‘text’ name=‘qty’ size=‘2’> for each colour and size which clearly won’t work.
I thought of adding the information into the field such as Black||S and Black||M and so on but a text field will not hold that information. I also thought about adding a hidden field but that won’t work either as you can’t tie the 2 fields together.
Any help or suggestions on how I can achieve this would be great.