Render A Contact Form Into A View Of Another Model

I have created contactowner.php view to generate contact form same as default contact form created by yii app.

purpose is to create and render that contact form into the view of the adds model. (for each add displayed in view.php )

it display the form in the view for each adds but its not working at all when submit button is pressed.


<p>For business inquiries or other questions, please fill out the following form to contact the publisher of this add.


<div class="form">

<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(







)); ?>

<?php echo "<br>"; ?>

<?php echo $form->errorSummary($model); ?>

<?php echo $form->textFieldRow($model,'name',array('size'=>50,'maxlength'=>50,'value'=>Yii::app()->user->name,'disabled'=>'disabled')); ?>

<?php echo $form->textFieldRow($model,'email'); ?>

<?php echo $form->textFieldRow($model,'subject',array('size'=>60,'maxlength'=>128)); ?>

<?php echo $form->textAreaRow($model,'body',array('rows'=>4, 'class'=>'span5')); ?>

<div class="form-actions">

<?php $this->widget('bootstrap.widgets.TbButton',array(





)); ?>


<?php $this->endWidget(); ?>

</div><!-- form -->

<?php endif; ?>

controller code—

public function actionContactowner()


$model=new ContactForm;








$headers="From: $name <{$model->email}>\r\n".

"Reply-To: {$model->email}\r\n".

"MIME-Version: 1.0\r\n".

"Content-type: text/plain; charset=UTF-8";


Yii::app()->user->setFlash('contact','Thank you for contacting us. We will respond to you as soon as possible.');






what is wrong in that code… help me please… thanks…