This will post you to the exact url you are at no matter how many
parameters you have.
echo $form->create('Modelname', array('url' => $this->here));
On May 19, 7:34 pm, Gabriel <[email protected]> wrote:
> O creo que podria simplificarse mas usando:
>
> <?php echo
> $form->create('Local',array('action'=>'agregar/'.$empresa['Empresa']['id'])
> );?>
>
> Ya que en la accion del formulario no pones el parametro.
>
> Y olvide las comillas en el mensaje anterior, seria:
> <input type="hidden" name="*data[Empresa][id]*" value="<?php echo
> $empresa['Empresa']['id']; ?>" />
> y
> this->redirect(array('action' => 'lista', *$this->data['Empresa']['id']*));
>
> Frannie escribió:
>
> > Hello. I want to thank you in advance for your time.
> > I am trying to make a form and the action that uses has a parameter,
> > but when I submit the form the parameter disappears....
>
> > *********this is my form:
>
> > <?php echo $form->create('Local',array('action'=>'agregar'));?>
> > <table>
> > <tr>
> > <th>Nombre</th>
> > <td><?php echo $form->input('Local.nombre', array('label'=>''));
> > ?></
> > td>
> > </tr>
> > <tr>
> > <th>Tipo</th>
> > <td><?php echo $form->input('Local.tipo', array
> > ('label'=>'','type'=>'select')); ?></td>
> > </tr>
> > <tr>
> > <th>Región</th>
> > <td><?php echo $form->input('region',
> > array('label'=>'','options'=>
> > $regiones)); ?></td>
> > </tr>
> > <tr>
> > <th>Comuna</th>
> > <td><?php echo $form->input('Local.comuna_id', array
> > ('label'=>'','type'=>'select')); ?></td>
> > </tr>
> > <tr>
> > <th>Dirección</th>
> > <td><?php echo $form->input('Local.direccion',
> > array('label'=>'')); ?
>
> >> </td>
>
> > </tr>
> > <tr>
> > <th>Teléfono</th>
> > <td><?php echo $form->input('Local.telefono',
> > array('label'=>'')); ?
>
> >> </td>
>
> > </tr>
> > <tr>
> > <th>E-mail</th>
> > <td><?php echo $form->input('Local.email', array('label'=>''));
> > ?></
> > td>
> > </tr>
> > <tr>
> > <th>Patente</th>
> > <td><?php echo $form->input('Local.patente',
> > array('label'=>'')); ?
>
> >> </td>
>
> > </tr>
> > </table>
> > <?php echo $form->end('Guardar');?>
>
> > ***********this is the action:
> > function agregar($empresa_id){
>
> > $this->set('CSS','estilo');
> > $this->set('empresas_list',$this->Nav->showEmpresas());
> > $this->set('empresa',$this->Empresa->find('first', array
> > ('conditions' => array('Empresa.id' => $empresa_id))));
>
> > $this->set('comunas', $this->Local->Comuna->find('list'));
> > $this->set('regiones',
> > $this->Local->Comuna->Region->find('list'));
> > $this->set('tipos', $this->Local->Catalogo->find('list', array
> > ('conditions'=> array('Catalogo.grupo'=>'tipo_local'))));
>
> > if (!empty($this->data)) {
> > if ($this->Local->save($this->data)) {
> > $this->Session->setFlash('Un nuevo local ha sido
> > agregado al
> > sistema.');
> > $this->redirect(array('action' => 'lista',
> > $empresa_id));
> > }
> > }
> > }
>
> > I load the view with an url like this: localhost/myroot/mycontroller/
> > agregar/1
> > then I fill the fields of the form and I submit, and then I lose my
> > parameter. Does anybody know why this could be?
> > I'm sorry, english is not my first language, if you have any questions
> > about my problem just tell me.
> > I really will appreciate your help.
>
> > Francisca.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---