Php 如何设置表单输入的名称
我有以下资料:Php 如何设置表单输入的名称,php,cakephp,Php,Cakephp,我有以下资料: $this->Form->input('type', array( 'options' => array( 'Blog', 'Forum', 'News', 'Other' ), 'empty' => '(Select a type)' ), array('title' => 'Select your websites type')); 但是,标题没有更改,而是
$this->Form->input('type', array(
'options' => array(
'Blog',
'Forum',
'News',
'Other'
),
'empty' => '(Select a type)'
), array('title' => 'Select your websites type'));
但是,标题没有更改,而是标题为“type
”。如何更改标题?我假设“标题”指的是输入的标签
$this->Form->input('type', array(
'options' => array('Blog',
'Forum',
'News',
'Other'),
'empty' => '(Select a type)',
'label' => 'Select your websites type'));
如果您指的是html属性“title”,并且不介意select的标签,那么
$this->Form->input('type', array(
'options' => array('Blog',
'Forum',
'News',
'Other'),
'empty' => '(Select a type)',
'title' => 'Select your websites type'));
当然,您可以将它们混在一起。如果您想将名称从
'type'
更改为其他名称,只需在代码中替换type
:
$this->Form->input('NEW NAME HERE', array(
'options' => array(
'Blog',
'Forum',
'News',
'Other'
),
'empty' => '(Select a type)'
));
FormHelper::input
没有第三个参数,选项和属性都在第二个参数中。