Just seeing if any of you have an idea to make life easier for me!
I have a form that submits boots into a database.
Each type of boot is available in various colours and sizes.
Example
Black size 1
Black size 2
Black size 3
On the form I have a column for each colour with approx 15 size tick boxes for each.
So there are approx 10 colours with 15 sizes of each.
and therefore 150 variables that need processing.
I could have made the form tick boxes as arrays but that will result in only the ticked boxes being included into the array.
The field in the database stores an imploded array of the available sizes in each colour
0_1_1_1_0_1_1_0
The problem i am faced with is changing an empty variable into a 0 so that the imploded array correspends in sequence to the boot size.
The code to do this looks something like this
if(empty($black1)){
$black1 = 0;
}
if(empty($black2)){
$black2 = 0;
}
so this statement is repeated 150 times.
Is there any quick way to navigate through all the variables available?
Thanks in advance!