Redirect to Another Action in Same Controller with Parameters – How to

redirect

i want to pass parameter from one action to another in same controller
how to do that

also how the other function receive(how to get it ) parameters??

$parameters =array('user_id'=>5,'name'=>'test');
is $this->_forward('edit',NULL,NULL,$parameters); correct or what is the correct way ??

and if it is correct how to get parameters in edit action

Best Answer

Yes your code seem correct

$parameters =array('user_id'=>5,'name'=>'test');
$this->_forward('edit',NULL,NULL,$parameters);


public function editAction()
{
    $user_id = $this->getRequest()->getParam('user_id');
    $name = $this->getRequest()->getParam('name');