I am in the controller using ‘details’ action.
I also got some parameters in the request.
I would like to redirect to another action AND passing all the parameters to it.
I am in the controller using ‘details’ action.
I also got some parameters in the request.
I would like to redirect to another action AND passing all the parameters to it.
if i understand your problem, juste call your other action
actionFunctionA() {
…
$this->actionFunctionB();
…
}
actionFunctionB() {
…
…
}
This is not good, as the action is kept in the browser, and will cause problems when the user refreshes the page. The code will be executed each time, I need to redirect after I’ve processed the task.
ok try this
$chaine = "&";
foreach($_REQUEST as $key=>$value) {
if($key!="r")
$chaine .= $key."=".$value."&";
}
header("Location:index.php?r=controller/action".$chaine);
more Yiiish perhaps others will use it…
$tab = array();
$tab[] = "commande/update";
foreach($_REQUEST as $key=>$value) {
if($key!="r")
$tab[$key] = $value;
}
$this->redirect($tab);
Is not possible to do a redirect and post variable, you can use only get.
If you want to resend all get parameter, you can create the url like that:
$this->redirect(array('action', $_GET));
That will pass all get variables to the action. If you have some parameter that you don’t want to pass, do unset:
unset($_GET['undesiredParameter'])
If you want to pass more parameters, set them:
$_GET['oneMoreParameter']='value';
As you are going to redirect, don’t be afraid of touching the $_GET array.
Thanks zaccaria.
Need use merge.
$this->redirect(array_merge(array('action'), $_GET));