CheckBox value

How to get CheckBox value? When I checked one of four checkboxes then I got value 1 but I need actual value.

<?php foreach($models as $n=>$form): ?>

<div class="simple">

<?php echo CHtml::activeLabelEx($form,‘telephone’); ?>

<?php echo CHtml::activeCheckBox($form,‘telephone’,CHtml::listData(CActiveRecord::model(‘phoneForm’)->findAll(),‘id’,‘telephone’)); ?>

</div>

<?php endforeach; ?>

CVarDumper::dump( $_POST ); see it~maybe can help you~

I got array().

I think you are searching for


CHtml::activeCheckBoxList()

Regards

I got 1 or 0 when I check but I need actual value. Is that possible?

Here is my view form. When i submit then I got Array, but I need checkbox value. Is that possible?

    &lt;?php foreach(&#036;models as &#036;n=&gt;&#036;form): ?&gt;





&lt;tr&gt;


	&lt;td colspan=2&gt;&lt;?php echo CHtml::activeCheckBoxList(&#036;form,'personal',array('telephone','email')); ?&gt;&lt;/td&gt;


&lt;/tr&gt;


&lt;?php endforeach; ?&gt;

Sorry, but I have not the time to write some sample code atm. I hope http://www.yiiframework.com/doc/api/1.0.10/CHtml#activeCheckBoxList-detail can help you.

Yes, that is possible

In the controller, If I use this to get array value

$form->systems[0]

then I see the one value. Is that any way to use for loop to get the array value