Php Notice While Accessing A Page (Undefined Variable: Model )

Hi All,

I am a newbie.

I have installed and created a sample demo website using YII framework.

Also have used gii to create models and controllers.

But when I create a Model (myProfileForm.php), Controller (MyProfileController) and view (MyProfile/index.php),

I get the following error:

PHP notice

Undefined variable: model

I have attached the files.Please help me to solve this issue.4606

MyProfileForm.php

4607

MyProfileController.php

Thanks & Regards,

Vidhya

[/size]

[size=2]Where you get this err?[/size]

Post your error with fileName/lineNumber.

[/size]

On action index in controller you directly render MyProfile view page,




public function actionIndex()

	{

		$this->render('myProfile');

	}

Where in MyProfile.php view page you use $model which is neither initialize in controller nor in view file… thats why its giving err.

Hi Kiran Sharma

Thank you for highlighting that.

Modifying the below function, solved the issue.





public function actionIndex()

	{

            $model=new MyProfileForm;	

            $this->render('myProfile',array('model'=>$model));

	}

Thank you once again.

Thanks & Regards,

Vidhya