On Jan 18, 2011, at 01:40, andy_the ultimate baker wrote:

> i m trying to redirect the action on a controller but it is
> redirecting to another controller action.
> //users_controller.php
> function admin_add(){
>               if(!empty($this->data)){
>                       if($this->save($this->data)){
>                               $this->Session->setFlash('A new category has 
> been added ');
>                               $this->redirect(array('action' => 
> 'admin_index'));
>                       }
>               }
>       }
> in above the action "admin_index" is in users_controller.php but it is
> redirecting to the action "admin_index" of controller
> "category_controller.php".

Clearly, you should tell it you want it to go to the users controller, then.

$this->redirect(array('controller' => 'users', 'action' => 'admin_index'));

Otherwise it's going to assume you want to remain in the same controller (and 
judging from the flash message you're setting, you're currently in the 
categories controller).



Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

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

Reply via email to