I have following code in form. Kindly see names of form fields
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'user-form',
'action' => 'create',
'enableAjaxValidation' => false,
));
?>
<p class="note">Fields with <span class="required">*</span> are required.</p>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model, 'Username');?>
<?php echo $form->textField($model, 'wausername', array('size'=>60, 'minlength' => 3 , 'maxlength' => 128, 'id' => 'myUsernameID', 'name' => 'myUsername'));?>
<?php echo $form->error($model, 'wausername', array('name' => 'waErrorMessage', 'id' => 'waErrorMessageID'));?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'Password');?>
<?php echo $form->textField($model, 'wapassword', array('size' => 60, 'maxlength' => 128, 'id'=> 'myPasswordID', 'name'=> 'myPassword'));?>
<?php echo $form->error($model, 'wapassword', array('name' => 'waPasswordErrorMEssage', 'id' => 'waPasswordErrorMEssageID'));?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save', array('id' => 'myID', 'name' => 'mySubmitName'));?>
</div>
<?php $this->endWidget(); ?>
Following is table schema :
--
-- Table structure for table `watable`
--
CREATE TABLE IF NOT EXISTS `watable` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`wausername` varchar(128) NOT NULL,
`wapassword` varchar(128) NOT NULL,
`waemail` varchar(128) NOT NULL,
`wadetail` varchar(128) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=23 ;
You can see that form fields are different from column names. How can I insert new record in database by using YII CActiveRecord.Or is there any other class in YII for this purpose.
Thanks in advance