title: How to modify two databes tables in one form in Yii
body: <p>I have created one form to eddit one table(hotel_rooms) in my database from my website page, it works perdectcly.
  But I need to include some fields,not all the table, from another table (hotel_rooms_checked)in the edditing web page of the privious table (hotel_rooms)
  how can I do it please ? where <code>hotel_rooms.Id = hotel_rooms_checked.Id</code>
  here is the code for the form</p>
  
  <pre><code>    &lt;?php
      /* @var $this HotelRoomsController */
      /* @var $model HotelRooms */
      /* @var $form CActiveForm */
      ?&gt;
  
      &lt;div class="form"&gt;
  
      &lt;?php $form=$this-&gt;beginWidget('CActiveForm', array(
          'id'=&gt;'hotel-rooms-form',
          'enableAjaxValidation'=&gt;false,
      )); ?&gt;
  
          &lt;p class="note"&gt;Fields with &lt;span class="required"&gt;*&lt;/span&gt; are required.&lt;/p&gt;
  
          &lt;?php echo $form-&gt;errorSummary($model); ?&gt;
  
          &lt;div class="row"&gt;
              &lt;?php echo $form-&gt;labelEx($model,'Id'); ?&gt;
              &lt;?php echo $form-&gt;textField($model,'Id',array('size'=&gt;60,'maxlength'=&gt;255)); ?&gt;
              &lt;?php echo $form-&gt;error($model,'Id'); ?&gt;
          &lt;/div&gt;
  
  .......
      &lt;?php $this-&gt;endWidget(); ?&gt;
  
      &lt;/div&gt;&lt;!-- form --&gt;
  </code></pre>
  
  <p>and this is the controller code </p>
  
  <pre><code>public function actionUpdate($id)
      {
          $model=$this-&gt;loadModel($id);
  
          // Uncomment the following line if AJAX validation is needed
          // $this-&gt;performAjaxValidation($model);
  
          if(isset($_POST['HotelRooms']))
          {
              $model-&gt;attributes=$_POST['HotelRooms'];
              if($model-&gt;save())
          // $this-&gt;redirect(Yii::app()-&gt;request-&gt;urlReferrer);
  
                  $this-&gt;redirect(array('hotels/index','id'=&gt;$model-&gt;Id));
          }
  
          $this-&gt;render('update',array(
              'model'=&gt;$model,
          ));
      }
  </code></pre>
  
  <p>the view code is</p>
  
  <pre><code>&lt;?php
  /* @var $this HotelRoomsController */
  /* @var $model HotelRooms */
  
  $this-&gt;breadcrumbs=array(
      'Hotel Rooms'=&gt;array('index'),
      $model-&gt;Id,
  );
  
  $this-&gt;menu=array(
      array('label'=&gt;'List HotelRooms', 'url'=&gt;array('index')),
      array('label'=&gt;'Create HotelRooms', 'url'=&gt;array('create')),
      array('label'=&gt;'Update HotelRooms', 'url'=&gt;array('update', 'id'=&gt;$model-&gt;Id)),
      array('label'=&gt;'Delete HotelRooms', 'url'=&gt;'#', 'linkOptions'=&gt;array('submit'=&gt;array('delete','id'=&gt;$model-&gt;Id),'confirm'=&gt;'Are you sure you want to delete this item?')),
      array('label'=&gt;'Manage HotelRooms', 'url'=&gt;array('admin')),
  );
  ?&gt;
  
  &lt;h1&gt;View Room : &lt;?php echo $model-&gt;Id; ?&gt;&lt;/h1&gt;
  
  &lt;?php $this-&gt;widget('zii.widgets.CDetailView', array(
      'data'=&gt;$model,
      'data'=&gt;$model2,
      'attributes'=&gt;array(
          'Id',
          'HotelName',
          'HotelRoomsType',
          ....
      ),
  )); ?&gt;
  </code></pre>
  
  <p>the structure oh the tables </p>
  
  <pre><code>Hotel_Rooms
  Id
  HotelName
  HotelRoomsType
  .....
  
  Hotel_Rooms_Checked
  Id
  DateCheckedIn
  DateCheckedOut
  ....
  </code></pre>