Html radioList is a helper class of Yii framework that is used to create a list of radio buttons. It generates an HTML form that contains radio options generated from the provided array of items.
Example 1:
This example creates a radio button list of colors where the default color is red.
Example 2:
This example creates a radio button list of cars where multiple options can be selected.
php
'Mercedes',
'bmw' => 'BMW',
'audi' => 'Audi',
'toyota' => 'Toyota',
], [
'separator' => ' '
]);
?>
```
In both examples, the first argument of the radioList method is the name of the input field. The second argument specifies the default selection or an array of selected values for the radio button list. The third argument is an array of items used to generate the radio button list. The fourth argument is an array of HTML options that can be applied to the input field.
The Html radioList helper class is part of the yii\helpers package library. It provides a variety of useful functions for creating HTML input controls.
PHP yii\helpers Html::radioList - 30 examples found. These are the top rated real world PHP examples of yii\helpers\Html::radioList extracted from open source projects. You can rate examples to help us improve the quality of examples.