Finally, I find the solutions… Putting some alias and folder problems… Once found, it’s easy
Finally, I find the solutions… Putting some alias and folder problems… Once found, it’s easy
I WNT TO PASS $modelAddress to next page help me
i am copping my code here i dont got the $modelAddress on next page
CONTRLLER
public function actionCreate()
{
$model=new EmpInfo;
$modelAddress = new Address;
#echo("<script>alert('in employee yii create controller');</script>");
// Uncomment the following line if AJAX validation is needed
$this->performAjaxValidation($model);
// if ($model->load(Yii::$app->request->post()))
// {
// $modelsAddress = Model::createMultiple(Address::classname());
// Model::loadMultiple($modelsAddress, Yii::$app->request->post());
// }
if(isset($_POST['EmpInfo'],$_POST['Address']))
{
$model->attributes=$_POST['EmpInfo'];
$modelAddress->attributes=$_POST['Address'];
// validate BOTH $model and $modelAddress
$valid=$model->validate();
$valid=$modelAddress->validate() && $valid;
if($valid)
{
// use false parameter to disable validation
$model->save(false);
$modelAddress->save(false);
// ...redirect to another page
}
// if($model->save())
// $this->redirect(array(‘data’,‘id’=>$model->emp_id));
}
$this->render('create', array('model' => $model,'modelAddress' => $modelAddress));
}
I $modelAddress to next form but error is accured undefined modelAddress