无论我尝试什么
,我的select标签的值似乎都没有发布到我的控制器上选择标记
<select name="whatever">
<?php
foreach($packs as $packName => $pack) {
echo " '<option value=" . $packName . '">' . $packName . '</option>';
}
?>
</select>
我尝试在控制器中使用它
function procedures() {
$errors = array();
$otsing= "";
if (!isset($this->data)) {
App::import('Helper', 'Formatter');
$formatter = new FormatterHelper();
$this->data['start'] =
$formatter->FormatDate($this->Dating->Now());
$this->data['end'] = $formatter->FormatDate($this->Dating->Now());
if(!empty($_POST['whatever']))
{
$otsing = $this->$_POST['whatever'];
}
}
}
答案 0 :(得分:1)
选择名称应该写成
data[Formname][selectname]
如果您想以HTML格式提供,或者您应该使用cakephp方式来定义下拉列表:
<?php
echo $form->select(‘whatever’,$packs)
?>