Another day struggling with a piece of code and need to get some inputs to proceed.
I have a form that displays the results of a db query ($items) in a tabular manner. I need to have either a radio button or a submit button that will return the value of the row or a unique field from the $items list.
The partial form code is below:
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'select-form',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<table>
<tr><th>Name</th><th>Match Time</th><th>Clubs Free</th><th>Your Choice</th></tr>
<?php foreach($items as $i=>$item): ?>
<tr>
<td><?php echo "$item[nameCountry]" ?></td>
<td><?php echo "$item[time]"; ?></td>
<td><?php echo "$item[clubsFree]"; ?></td>
<td>
<?php echo CHtml::radioButton("$item[idCountry]"); ?>
</td>
<td><input type="submit" id=<?php echo "$item[idCountry]" ?> name="countrySelected" value="Select"/>
</td>
</tr>
<?php endforeach; ?>
</table>
<div class="row buttons">
<?php echo CHtml::hiddenField('idCountry',null,array('id'=>'select-form')); ?>
<?php echo CHtml::submitButton('Select'); ?>
</div>
<?php $this->endWidget(); ?>
</div><!-- form -->
I have tried a var_dump of the POST array, but I do not get a unique value on either the radio button or the submit button.