Having trouble assigning a label to an optgroup.
my controller
$ranks = $this->Rankforuser->Rank->find('list', array( 'fields' =>
array('Rank.id', 'Rank.rank_name','Rank.program_id'), 'order' =>
array('Rank.sort_id' => 'ASC') ));
debug($ranks);
$programs = $this->Rankforuser->Program->find('list');
produces:
Array
(
[1] => Array
(
[1] => White Belt
[2] => Yellow Belt
[4] => Green Belt
)
[2] => Array
(
[27] => White Belt
[25] => Dragon White Belt
[26] => Dragon Yellow Belt
)
)
would like it to produce:
Array
(
[taekwondo] => Array
(
[1] => White Belt
[2] => Yellow Belt
[4] => Green Belt
)
[kungfu] => Array
(
[27] => White Belt
[25] => Dragon White Belt
[26] => Dragon Yellow Belt
)
)
my view
echo $this->Form->input('rank_id');
is there some way to achieve this with the database call or in the
view with the input formatting?
or do I need to restructure the array then pass it to the view?
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php