Coc*_*cco 4 parameters action cakephp parameter-passing
嗨,我在cakephp有点新,调整很麻烦..这是我最大的问题..
我试图将一个参数传递给一个动作,它确实加载,但是当我的脚本从控制器转到视图,并再次返回控制器时,它就消失了.
控制器代码
function add($mac = 0)
{
if(isset($this->params['form']['medico']))
{
$temp= $this->Person->find('first', array('conditions' => array('smartphones_MAC' => $mac)));
$id= $temp['Person']['id'];
$this->Union->set('events_id', $id+1);
$this->Union->set('people_id', $id);
$this->Union->save();
}
Run Code Online (Sandbox Code Playgroud)
查看代码(这是一个菜单,我现在只有一个按钮)
<fieldset>
<legend>SELECCIONE SU ALERTA</legend>
<?php
echo $form->create('Event');
echo $form->submit('EMERGENCIA MEDICA',array('name'=>'medico'));
echo $form->end();
?>
</fieldset>
Run Code Online (Sandbox Code Playgroud)
Mar*_*ory 12
创建表单时,不包括其他url参数或字段作为输入.如果没有这些参数,参数将会消失,因为它们不是新请求的一部分.您可以将附加参数附加到表单提交URL
$form->create('Event', array(
'url' => array('something', 'somethingelse')
));
这将创建一个指向的表单/events/add/something/somethingelse.
| 归档时间: |
|
| 查看次数: |
18656 次 |
| 最近记录: |