CakePHP Form Helper Database Interaction
- by xtine
Currently I am developing a CakePHP that will list various businesses.
In the database, there is a table for businesses that lists them like so:
id | name | address | city | state | state_id | zip | url
The state column are abbreviations of states (for listing purposes) CA, AK, FL, etc and the state_id matches up with the ids in the states table:
id | name | state_abbr
I have an admin_add.ctp template with form helpers for inserting new businesses.
For entering a state for a business I am going to have a pull down that lists all the states. However, how do I make the database insert so it will know how to add the state abbreviation and state id when I submit the form to add the business?