i have form which is written in pure Html tags...
<form method="post" action="<?php echo Yii::app()->getBaseUrl(true).'/index.php?r=user/create'?>">
<div class="row">
<label>Username</label><input type="text" name="username"/>
</div>
<div class="row">
<label>Password</label><input type="password" name="password"/>
</div>
<div class="row">
<label>Email</label><input type="text" name="email"/>
</div>
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
now i want to save data in database using my controller method Create and i also want to validate it first... i don't know how to do it....
i know how to do it using in CActiveForm and CHtml
i have model class generated using Gii... and my controller method is...
public function actionCreate()
{
$model=new User;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['User']))
{
$model->attributes=$_POST['User'];
if($model->save())
$this->redirect(array('view','id'=>$model->UserId));
}
$this->render('create',array(
'model'=>$model,
));
}
Can anybody suggest me some startup code for that...
thanks in advance