Undefined Variable: Model In Cformmodel

I am trying to create a form using CFormModel.CFormModel is used for the without database table.form in the form of checkboxlist and textbox.after complete the form and then after submit the form but i found error i.e,

Undefined variable: model .

where is the problem i am not understand.

any help which is appreciated to me…thanks

my code is below…

Hi my friend

generally the CFormModel doesn’t has ids, so you can’t use Search::model()->findByPk($id)

You have to extend your Search model by CActiveRecord but it depends by what you want

thanks KonApaz

ok,then how to fetch the selected data of the form in to the controller class(actioncreate).

$model=new Search;






…you code after validated form’s value



here is my action create code…

public function actionCreate()


	$model=new Search;

	// Uncomment the following line if AJAX validation is needed

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




		  if ($model->validate())

    // $this->redirect(Yii::app()->user->returnUrl);












in place of



what am i write here in place of id.

actually i am new in yii so i have some problem.

It depends what you want to do

the $this->redirect(‘view’,‘id’=>$model->brand)) means

redirection to <currentController>/view&id=<$model->brand)>

passing to the actionView the $id variable with $model->brand

What exactly you want to do?