以下是我用于在selectbox中显示值的代码。但是如何显示下面代码中选择的值对我来说不起作用..
$currencyName = Array
(
[$] => US Dollar
[$] => rdcyhgv976
[€] => Euro
[£] => UK Pound
[¥] => Japanese yen
[a] => a
[b] => test
)
$selected=Array
(
[Currency] => €
)
<?php
echo $this->Form->input('SystemUser.Currency', array('type'=>'select','options'=> $currencyName, 'selected'=>$selected['Currency'], 'label' => false, 'div' => false, ));
?>
任何人都可以告诉我哪里错了吗?
答案 0 :(得分:0)
你试过吗
<?php
echo $this->Form->input('SystemUser.Currency', array('type'=>'select','options'=> $currencyName, 'default'=>$selected, 'label' => false, 'div' => false, ));
?>
将“已选择”更改为“默认”。