CakePHP Form Helper Database Interaction
        Posted  
        
            by xtine
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by xtine
        
        
        
        Published on 2010-04-21T07:38:08Z
        Indexed on 
            2010/04/21
            7:43 UTC
        
        
        Read the original article
        Hit count: 263
        
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?
© Stack Overflow or respective owner