I want to create an add method but take a parameter to save the record in the database without having to enter from the sight of the value of name.
I have a table meseros with the following fields:
id -> int(11)
name -> string -> 255
code -> int(255)
So in view of this function we have:
echo $this->Form->end(‘Agregar Crear Mesero’);
The value containing $code will be sent from another controller that calls the following function add:
public function add($apellido=null)
$this->Session->setFlash(‘The mesero ha sido guardada.’,‘default’,array(‘class’=>‘success’));
return $this->redirect(array(‘action’ => ‘index’));
$this->Session->setFlash(__(‘The mesero could not be saved. Please, try again.’));
In this particular case, I create the record but I have not desired code.
How can you solve this problem that I expose you?
How I can get the id of the record you just created (with create ()) and save (to save ()) ?
This last question really interests me.