我有以下数组数据是从不是我的表中获取的。
Array
(
[0] => Array
(
[sys_sbu] => Array
(
[sbu_id] => EO
[sbu_name] => Executive Officer
)
)
[1] => Array
(
[sys_sbu] => Array
(
[sbu_id] => FIN
[sbu_name] => Finance
)
)
[2] => Array
(
[sys_sbu] => Array
(
[sbu_id] => G01
[sbu_name] => TEST GROUP
)
)
[3] => Array
(
[sys_sbu] => Array
(
[sbu_id] => MAF
[sbu_name] => Medical Affairs
)
)
[4] => Array
(
[sys_sbu] => Array
(
[sbu_id] => PCS
[sbu_name] => Patient Care Services
)
)
[5] => Array
(
[sys_sbu] => Array
(
[sbu_id] => SSS
[sbu_name] => Strategic Support Services
)
)
)
基本上,该表sys_sbu
有 2 列。sbu_id
和sbu_name
。在我看来使用以下代码似乎不会产生预期的结果。
echo $this->Form->input('Groups', array(
'type'=>'select',
'options' => $groups)
);
我想要发生的是每个select
选项的值将是,sbu_id
而显示给选择的是sbu_name
. 像这样:
<select>
<option value="EO">Executive Officer</option>
<option value="FIN">Finance</option>
<option value="etc">etc</option>
</select>
我如何实现这一目标?