如何在CakePHP中填充数据库值的下拉列表 [英] How to populate drop-down list with database values in CakePHP
本文介绍了如何在CakePHP中填充数据库值的下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是CakePHP的新手。请解释一下我从数据库中填充值的选择下拉列表所需的步骤。
I am very new to CakePHP. Could you please explain me the steps needed to populate a select drop-down with values from the database. Please also suggest me some links to the reference.
推荐答案
您在db中进行查找,然后通过 $ this-> set(yourvariable)
在控制器中。
You make a find in the db and then set the variable via $this->set(yourvariable)
in the controller.
在视图中使用yourvariable选择标签
In the view you use the "yourvariable" in the select tag
Fill select 1
这篇关于如何在CakePHP中填充数据库值的下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文