Cakephp 3.0 表单下拉列表如何显示级别
Cakephp 3.0 form dropdown how to show level
我正在尝试为性别添加一个表单字段,下面是我的代码:
$options = ['m' => 'Male', 'f' => 'Female'];
echo $this->Form->select('gender', $options);
但是在我的视图文件中我无法看到 lebel 性别是否有任何其他代码可以帮助我建议。
From->select 没有给出正确的标签。只是做:
echo $this->Form->input('gender', array(
'options' => $options,
'type' => 'select',
'empty' => 'Select the gender',
'label' => 'Gender'
)
);
<?= $this->Form->select('gender', ['m' => 'Male', 'f' => 'Female'], ['class' => 'form-control', 'required' => true])?>
我正在尝试为性别添加一个表单字段,下面是我的代码:
$options = ['m' => 'Male', 'f' => 'Female']; echo $this->Form->select('gender', $options);
但是在我的视图文件中我无法看到 lebel 性别是否有任何其他代码可以帮助我建议。
From->select 没有给出正确的标签。只是做:
echo $this->Form->input('gender', array(
'options' => $options,
'type' => 'select',
'empty' => 'Select the gender',
'label' => 'Gender'
)
);
<?= $this->Form->select('gender', ['m' => 'Male', 'f' => 'Female'], ['class' => 'form-control', 'required' => true])?>