echo CHtml::activeRadioButton($model, 'gender', array('value'=>'male')); echo 'Male'; echo CHtml::activeRadioButton($model, 'gender', array('value'=>'female')); echo 'Female';
echo CHtml::activeRadioButton($model, 'agree', array('value'=>1, 'uncheckValue'=>0)); echo 'I agree to the terms and conditions';In this example, we are creating a single radio button for the agree field of a model. The radio button is checked by default if the value of "agree" attribute in the model is 1. The text "I agree to the terms and conditions" is displayed next to the radio button. Package library: Yii framework.