How to make a drop down list in yii2

Yii2 DropDownList syntax

echo $form->field($model, 'name_field')->dropDownList(

DropDownList with model data

Using below code snippet you can display the database table column’s data in the dropdownList via modal.

//use app\models\Country;

//use yii\helpers\ArrayHelper;

echo $form->field($model, 'name')->dropDownList(


Add a Comment

Your email address will not be published. Required fields are marked *