Reputation: 156
I'm developing e-commerce website in cakephp 2.x, in which admin can upload many images and each image will have individual color. " Problem is how to give option to admin to choose color for each image." like
image A has color black,
Image B has color Blue,
Image C has color grey
echo $this->Form->input('Color');
convert into drop down list to select color(Colors are saved in database). I'm confuse how to display drop down menu to admin against each image to select. if i use it multiple time $this->Form->input('Color');
, it creates with same id and in controller only one color is received. if i use $this->Form->input('Color',$i); to create drop down with different id then it not convert into drop down . it is just text field(because field name does not match and cakephp does not convert it into drop down list), so any suggestion will be appreciated.
Upvotes: 1
Views: 58
Reputation: 2272
Well in that case, put the dropdown options manually:
foreach($images as $key => $image) {
echo $this->Form->input('Color.' . $key, array(
'options' => $colors,
));
}
Upvotes: 1