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"=>array("city1"=>"city1","city2"=>"city2","city3"=>"city3","city4"=>"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","city4"=>"city4"), "default" => "city1"));
Comments
Post a Comment