Best Way For Passing Variables Through Many Pages?

I have 3 models : User, Skill, Job with relationship : User—> Skill —> Job. So if user create or update the User, the detail of user must be store somewhere or pass to Skill page. In Skill, user input data for the skill that belong to selected User from previous page then store or pass User detail and Skill detail to Job page. Same with Job page. It means user in the last step could review their input before submit it.

From my knowledge, there are some ways like that to pass multi variables:

  • Use hidden field

  • Pass directly with URL address

  • Store temporary in XML file

  • Use session

  • Create input table to store temporary data

Just want to ask which way is the best in term of performance and reliable, especially when there are more than 3 models?

If for example you use cjuitabs, you should have the 3 models into the same page - each in a tab.

You’d 3 buttons - one in each tab - that send data by POST, and the variables would be the models themselves sent by the controller.


Thank so much for your reply but the thing not like that. This is user management which has 3 steps: User -> Skill ->Job. I dont need to send multi models at once because I could create new model and assign attribute for it, then save. The thing is the user must input User detail first then move to NEXT page to create the Skill for this user. There will be 4 buttons : Back, Review, Save and Next. So user could review the detail before save .If not satisfy, move back to change everything.

Hi @clonevn

each model have to store own data.

So after of save the first model you have to pass the stored user id to another form that contains the Skill model.

when the action saveSkills runs, have to get this id and save the Skills with related user id.

If you ask where you have to put the id of user, the default way is in post method like that.

<?php $form=$this->beginWidget('CActiveForm', array(


        'action' => Yii::app()->createUrl('yourcontroller/youractionsave',array('id'=>$idvalue)), 

)); ?>