php - Some issue with the country, state and city dropdown in cakephp -
there 3 tables 1 country, 2nd 1 state , last 1 city. in table named address have city_id only. need when add new address want state dropdown dynamically populated when select country , same city. there no relation between address table , country table. how can link address country , state. wanna show them in dropdowns. problem how use country , state controller object in address controller.
if understand question correctly, have set relations between models: address belongsto city, city belongsto state, state belongsto country. when retrieve address database, automatically retrieve state , country, unless specify otherwise.
here info on model associations: http://book.cakephp.org/view/1039/associations-linking-models-together (you didn't version of cakephp you're using linked latest one).
Comments
Post a Comment