0

我正在尝试使用表单助手创建一个表单并在操作中传递 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">

4

1 回答 1

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

于 2013-08-09T15:06:45.497 回答