cakephp: get values from a "cat" table in the "users_controller.php" file? -
I have a table "user" and a controller "users_controller.php" and I have another table called "category" , It is necessary to get the value from this table in the "Listall" verb ( site.com/users/listall ).
How can I get from any other table.
-
To select an element with categories, In the controller, find the categories to be used in a selected element
$ categories = $ this-> user-> category-> find ('list'); $ This-> (compact ('categories')) set;
- Add your selected element to the view:
$ form-> Input ('User.category_id'); Use the values contained in the
$ categories
variable for the cache automaticallycategory_id
, select Thank you to the Inflator if your price is different for some reasons Variable, then use$ form-> input ('User.category_id', array ('option' => $ values_array));
Comments
Post a Comment