code for having radio button in display page.


Anyone plz help me with the code for bringing radio button while displaying data from related tables…

I have 3 tables… survey, surveyquestion and surveyanswer

survey table has -> surveyid(Pk), surveyname

surveyquestion tables has -> questionid(Pk),surveyid(Foreign key),questiontitle

surveyanswer tables has -> answerid(Pk),questionid(foreign key),answer

I want to display the question and answer in the home page… and there must be a radiobutton before answers

help me to get the radio button


You can Use


tihs is my view.php file

<div class="view">

&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('questiontitle')); ?&gt;&lt;/b&gt;

&lt;?php echo  CHtml::encode(&#036;data-&gt;questiontitle); ?&gt;

&lt;br /&gt;

&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('answer')); ?&gt;&lt;/b&gt;

    &lt;?php echo CHtml::encode(&#036;data-&gt;surveyAnswers1s-&gt;answer); ?&gt;

//how i should alter the code to get the radio button?

&lt;br /&gt;


<?php echo CHtml::radio($data->surveyAnswers1s->answer); ?>