How To Send Data From One View To Another

Iam a new-b in Yii making a web application.

I want to send data from one of my view name "preview" to another controller(check) index view. via post method how to do it… Please help me…

Thanks in advance


For POST, maybe use javascript. For GET, try $this->redirect();

CController reference

Thanks for reply

I need to send a 3 dimensional array to a controller action i.e check(controller) and its view index… i tried sending it from hidden field in from but its not working. Tell me how can i send it… Is their any way

In my preference, I would put it in a session store for example… At least, if the data is not comes from any type of direct/indirect user input. Then I would redirect internally in the controller, not in the view (if I don’t have to show a redirecting in x seconds page, in this case a javascript window.location.href or whatever redirection is required), with for example a $this->redirect(array(‘uri’, ‘redirected’ => 1)). You’ll get a ‘redirected’ parameter with the information, how you came to the target action. You can check this parameter with


If value is true, you can check if the session contains that array. Use it, then delete it to avoid malfunction from refreshing the page or opening directly.

My two cents only.

Thanks Now iam using session instead of posting data.