0

I have a radiobutton list in yii php,but I don't know how to access the value from this it doesn't contain any name or identity

<?php
echo $form->radioButtonList($model,'priority', 
                        array('C'=>'CRITICAL','H'=>'HIGH','L'=>'LOW')
 array('separator'=>'')); 
?>

Please help me to sort out this. thanks

4

2 回答 2

0

当您在 Yii 中使用表单构建器时,它会以某种方式设置名称和 ID。假设您$model是 的一个实例User,在这种情况下,您的 html 名称属性将是User[priority]并且可以作为 $_POST['U​​ser']['priority'] 访问。html id 属性不使用数组,所以它是User_priority. 所以其中一个单选按钮看起来像这样:

<input type='radio' name='User[priority]' id='User_priority' value='C'> CRITICAL

您可以随时查看生成的 html 源代码以查看此内容。

于 2013-08-20T13:13:01.470 回答
0

你需要这样做才能看到价值
<?php echo $form->error($model, 'priority'); ?>
为你的帮助

于 2013-08-20T11:28:41.627 回答