CakePHP passing parameters to action
        Posted  
        
            by iancocco
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by iancocco
        
        
        
        Published on 2010-03-19T15:25:25Z
        Indexed on 
            2010/03/22
            2:01 UTC
        
        
        Read the original article
        Hit count: 425
        
Hi im kinda new in cakephp and having a lot of trouble adjusting.. Here's my biggest problem ..
Im trying to pass a parameter to an action, it does load, but when my script goes from the controller to the view, and goes back to the controller again, its gone.
CONTROLLER CODE
 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();
}
VIEW CODE (This is a menu, i only have one button right now)
 <fieldset>
 <legend>SELECCIONE SU ALERTA</legend>
 <?php 
  echo $form->create('Event'); 
  echo $form->submit('EMERGENCIA MEDICA',array('name'=>'medico')); 
  echo $form->end();
  ?> 
  </fieldset>
© Stack Overflow or respective owner