我正在尝试使用表单助手创建一个Form并在动作中传递id。
我想这样:
<form action="menus/recusar/2>
<?php echo $this->Form->create('Menus', array('action' => 'recusar', $id)) ?>
<?php echo $this->Form->end('Submit') ?>
结果:
<form action="/societario/menuses/recusar" 2="2" id="MenusRecusarForm" method="post" accept-charset="utf-8">
答案 0 :(得分:0)
它应该工作。尝试
$id = 2; //Your ID
echo $this->Form->create(null, array(
'url' => 'menus/recusar/' . $id,
'type' => 'post'
));
// or
echo $this->Form->create(null, array(
'url' => array('controller' => 'menus', 'action' => 'recusar', $id)
));
来源:http://book.cakephp.org/2.0/en/core-libraries/helpers/form.html#options-for-create