We need to post products here.
The product will have more than one color, while each color have different image.
I have created a form. in this form when user click add more color
, it will create them a block div to pick up multiple images for that color, and so on for the next color.
Here is the sketch or input that I will
create dynamically with js
//here is the master data
<input type="text" name="name"/>
//follows are the mapping data
<input type="text" name="color[red]" value="red" />
<input type="file" name="color[red][image1]" />
<input type="file" name="color[red][image2]" />
<input type="file" name="color[red][image3]" />
<input type="file" name="color[red][image4]" />
<input type="text" name="color[blue]" value="blue" />
<input type="file" name="color[blue][image1]" />
<input type="file" name="color[blue][image2]" />
<input type="file" name="color[blue][image3]" />
<input type="file" name="color[blue][image4]" />
And so on...
I need a help how to post the inputs above with php, so that the output array would be like this:
array (
name => one
color => array (
[0] => array (
name =>red
image => array (
[0] =>oneRed1.jpg
[1] =>oneRed2.jpg
[2] =>oneRed3.jpg
)
)
[1] => array (
name =>blue
image => array (
[0] =>oneBlue1.jpg
[1] =>oneBlue2.jpg
[2] =>oneBlue3.jpg
)
)
[2] => array (
name =>purple
image => array (
[0] =>onePurple1.jpg
[1] =>onePurple2.jpg
[2] =>onePurple3.jpg
)
)
)
)
Thank you very much in advance for any help.