Storing the record

I am using the following form in existing application to post the data to Yii application and save it there


<form name="regform" method="post" action="<? echo "required url/createuser"; ?>"

<input id="Fusername" name="user[UserName]" size="20" type="text" value="<?=$req_username?>">

<input name="Submit" value="Create Account" type="submit">

</form>

I am posting it to the controller with following action


public function actionCreateuser()

	{    

         $model=new user;

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

        echo $model->UserName;           // echoing    

	if($model->save())

	echo "success";                 //not echoing

		

	}

Can anybody help me with this




var_dump($model->getErrors());



Array(0) {}

Did you override $model->save()? If so, remember to have it return true (or false) at the end. That’s bitten me a couple of times too. A function that doesn’t return anything will not pass an if() test.

No i didn’t overwrite the save() function… Its working if i am saving it by using attributes but its not working as whole

Its working for


$model->save(true,array('UserName' => 'UserName'))

Moreover can anybody tell me hw to go back to the previous application… I tried redirect function but not properly. I have to also post some data back to the previous application

show the model

any beforeValidate()-, beforeSave()-Methodes, behaviors?