Yii2 html dropdownlist
Dropdownlist without model example is showing below. In this section Arrayhelper and Html classes are uses. In dropdownlist the first attribute is $name ,the second attribute is $options and third attribute is $items array.
use yii\helpers\Html; use yii\helpers\ArrayHelper; Html::dropDownList('user_id', null, ArrayHelper::map(User::find()->all(), 'user_id', 'name'))
No comments:
Post a Comment