如何在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

填写选择2

填写选择3