I am using the yii 2.0 framework. I can create options from my database I got it, but it Yii 1.1:
I want to pass it in the form:
& lt ;? Php $ form- & gt; Dropdown list ()? & Gt;
How do I fill my dropdown list from my database table?
yii \ helpers \ html
use html :: DropDownList ()
.
echo Html :: dropDownList ('listname', select $, ['m' = & gt; 'man', 'f' => 'woman']); Public Action Action Some () {$ sexes = ['M']
Controller
= & gt; 'Male', 'F' => 'Female']; $ This- & gt; Render ('Your Weave', ['Gender' = & gt; $ sexes]); }
View
& lt ;? Php :: echo Html :: dropDownList ('listname', $ select, $ genders); ::? & Gt;
Comments
Post a Comment