如何在yii 1框架中将表单发布数据插入数据库

this is my form in view

<div class="form">
<?php echo CHtml::errorSummary($model); ?>

<div class="row">
    <?php echo CHtml::activeLabel($model,'Your Name'); ?>
    <?php echo CHtml::activeTextField($model,'regname') ?>
</div>

<div class="row">
    <?php echo CHtml::activeLabel($model,'Your Password'); ?>
    <?php echo CHtml::activePasswordField($model,'regpass') ?>
</div>

<div class="row">
    <?php echo CHtml::activeLabel($model,'Email Address'); ?>
    <?php echo CHtml::activePasswordField($model,'regemail') ?>
</div>
 <div class="row">
    <?php echo CHtml::activeLabel($model,'Contact'); ?>
    <?php echo CHtml::activePasswordField($model,'regcontact') ?>
</div>

<div class="row submit">
    <?php echo CHtml::submitButton('Login'); ?>
</div>

please help me to save this data from my controller to model this is my model //-- set Table

public function tableName(){
    return 'user';
    }

    public function attributeLabels()
        {
          return array(
        'username'=>'Your username for the game',
        'password'=>'Your password for the game',
         'email'=>'Needed in the event of password resets',
                );
        }

and this is my controller

public function actionRegister2()
    {
        $model=new RegisterForm;
        if(isset($_POST['RegisterForm']))
        {
            echo 'done';
        }
        $this->render('register2',array(
                'model'=>$model,
            )); 

i an new in yii framework so didn't get a good tutorial for it, please suggest me how i insert the data into database by submitting a form

you can add this code in your controller:

public function actionRegister2()
{
     $model=new RegisterForm;
     if(isset($_POST['RegisterForm']))
     {
         $model->attributes = $_POST['RegisterForm'];
         if ($model->save()) {
            Yii::app()->user->setFlash('success', 'You have successfully added.');
            $this->redirect(array('index'));
        }
         // or if(!$model->save()){ print_r($model->getErrors())} 
    }
    $this->render('register2',array(
                    'model'=>$model,
           )); 
}