I need to populate a drop down menu with the field names of a table. How can I retrieve the field names using ActiveRecord? Or may be get the attributeLabels from the model?
Thanks.
I need to populate a drop down menu with the field names of a table. How can I retrieve the field names using ActiveRecord? Or may be get the attributeLabels from the model?
Thanks.
If your ActiveRecord’s models is ARModel, you can
$obj = new ARModel();
$arrFields = array_keys($obj->attributes);
Perfect!!!!
Thanks a lot Fabrizio Caldarelli.