Complete fill up of 2 forms before saving in 2 tables

Hi…

I have 2 tables which are [color="#FFFF00"]useraccounts[/color] and [color="#FFFF00"]basicdetails[/color]. and I have CRUD for each tables.

What I want is in the form input for create useraccounts should be fill up first followed by form input for create basicdetails then after completing this 2 forms then only the data will be saved to the 2 tables.

thanks…

Keep the first form’s POST values into a session and redirect to the next form . and insert both values in the second form’s insertion.

can you give me a sample code which I can used as reference…

in controller

in actionCreate





Yii::app()->session['name']=$_POST;




Give me your two forms actionCreate code.


public function actionCreate()

	{

		$model=new Useraccounts;

		


		// Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);


		if(isset($_POST['Useraccounts']))

		{

			$model->attributes=$_POST['Useraccounts'];

			if($model->save())

				$this->redirect(array('view','id'=>$model->id,));

		}


		$this->render('create',array(

			'model'=>$model,

		));

	}


public function actionCreate()

	{

		$model=new Basicdetails;


		// Uncomment the following line if AJAX validation is needed

		// $this->performAjaxValidation($model);


		if(isset($_POST['Basicdetails']))

		{

			$model->attributes=$_POST['Basicdetails'];

			if($model->save())

				$this->redirect(array('view','id'=>$model->id));

		}


		$this->render('create',array(

			'model'=>$model,

		));

	}