php - How to set a value fetched from database table as selected value in drop down list in cakephp? -


hey trying set selected="selected" drop down list cant seem solution.

e.g.. city entered in user's table when user chooses edit profile rest of details comes in text boxes city should displayed in drop down list , default selected value should match city of user.

note :- citites entered directly in

echo $this->form->input("city",array("type"=>"select","empty"=‌​>"city","options"=>a‌​rray("city1"=>"city1‌​","city2"=>"city2","‌​city3"=>"city3","cit‌​y4"=>"city4"))); 

you can use default make option selected in cakephp

try this:

echo $this->form->input('city', array('type' => 'select', 'options' => array("city1"=>"city1‌​","city2"=>"city2","‌​city3"=>"city3","cit‌​y4"=>"city4"), "default" => "city1")); 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -