Dropdown list with dyanmic optgroup

前端 未结 3 1034
抹茶落季
抹茶落季 2021-01-03 10:32

Hi there cakephp experts! I am looking for you help on a dyanmic dropdown list with dyanamic optgroup. Suppose I have two tables:

 countries:  id, country_na         


        
3条回答
  •  隐瞒了意图╮
    2021-01-03 11:20

    You can also use the Hash::combine function instead of a nested loop as suggested by @neilcrookes

    
    $counties = Hash::combine($countries,'{n}.County.id','{n}.County.name','{n}.Country.name'); 
    
    

提交回复
热议问题