使用default属性来设置单选框(type = radio)的默认值:
echo $form->input('Deal.type', array(
'type' => 'radio','div' => array('class' => 'radio'),
'options' => array(
'0' => 0,
'3' => 3,
'10' => 10,
),
'default' => 0,
));
使用selected属性设置下拉列表(type = select)的默认值:
echo $form->input('Deal.branch_id', array( 'type' => 'select',
'multiple' => true,
'options' => array(1,2,3),
'selected' => '1',
));
iefreer
本文将展示如何在PHP中使用default属性为单选框设置默认值,以及如何使用selected属性为下拉列表选择默认选项。
2435

被折叠的 条评论
为什么被折叠?



