I need your suggestion for a programming issue using Yii framework where based on the country selected in a country-drop-down-list, I need to display the respective states in the states-drop-down-list.

Here in db schema, I had created a foreign key for the country id. I checked in database that each country table had its unique id, name and State table had entries of state name, country id and state id. please provide me your suggestion for getting the respective list of states depending upon the country id selected in a drop down list.

thanks in advance.



Hi Nalajala,

maybe a look to the jquery-cascade extension can be useful for you.


CHtml::activeDropDownList($model, ‘attribute’, array(values), array(‘onChange’=>‘jsfunction’));

In these Way And no In Javascript Function Pass location:href on same page and pass City in Query String and

then in Controller Handle That Query String By $_GET[‘country’]

and Load data In Arrat And Assign To The Dropdown list In database

that;s Easy way to Do in Don;t know Jquery