Hi Community,
I’m updating some data in a ‘update’ view from controller ‘GestionesClientesController’.
The controller’s code is very simple and it wooks correctly:
[b]public function actionUpdate($id)
{
$model=$this->loadModel($id);
if(isset($_POST['GestionesClientes'])) {
$model->attributes=$_POST['GestionesClientes'];
if($model->save())
[b]$this->redirect(array('clientes/view','id'=>$model->id_cliente));[/b]
}
$this->render('update',array('model'=>$model,));
}[/b]
When I finish the update (submiting the update button) it goes (redirect) to another controller ‘ClientesController’ and it’s action ‘view’ with it’s id and it works fine.
the url in the browser looks like this: http://localhost/redes/clientes/9.asp
where 9 is the customerid.
My problem is in the view ‘update’ when I click in then menu link and I didn’t save the data, here is the code:
[b]$this->menu=array(
array('label'=>'Regresar', 'url'=>array('clientes/view', array('id'=>$model->id_cliente)))
);[/b]
when I click the link ‘regresar’ I’ve the following error: ERROR 400
the url in the browser looks like this: http://localhost/redes/clientes/view.asp?0[id]=9
What is the diference between redirect() and ‘url’ in the Menu.
What I’m doing wrong? Thanks in advance