Saving Data Via Form In Two Different Models

Hey iam new to yii…

i have encounter a situation where i need to create a controller which has its view named index and code goes as follows…

<?php echo $this->renderPartial('_form', array('user'=>$user, 'order'=>$order,)); ?>

in _form code is

$form=$this->beginWidget('CActiveForm', array(








                 echo $form->errorSummary(array($user,$order)); 


            <table class="form">



                  <td><?php echo $form->labelEx($user,'name'); ?></td>

                  <td><?php echo $form->textField($user,'name'); ?></td>

                  <td><?php echo $form->error($user,'name'); ?></td>



                  <td><?php echo $form->labelEx($user,'email'); ?></td>

                  <td><?php echo $form->textField($user,'email',); ?></td>

                  <td><?php echo $form->error($user,'email'); ?></td></tr>

<tr>$form->hiddenField($order,array('value'=>$products[$x][0])</tr>/*data to be used in order model*/

in controller code goes as

public function actionIndex()


	    $user=new User;

        $order=new Order;


        if(isset($_POST['user'], $_POST['order']))


            // populate input data to $user and $oder




            // validate BOTH $user and $oder


            $valid=$oder->validate() && $valid;




                // use false parameter to disable validation




                // ...redirect to another page










Their are two Models User and Order this is where i want to save the data…

But it is not working it gives no error… but from is not submiting… what is wrong in this code plz tell me plz plz plz :unsure: :unsure: :unsure:

 $valid=$oder->validate() && $valid;

is this a typo ($oder)?

this may help you