⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

How to display the country state and city in dropdown and having dependency on each other



Tarun Malviya

Tarun Malviya
  • profile picture
  • Member

Posted 07 March 2017 - 06:16 AM

when i use this code for city state country for showing dropdown i am not getting proper dependency. i want to show the all the state and city according to selected country in dropdown the below code i have written but not working proper

 

$crud->set_subject('Doctors');
$crud->set_table($this->config->item('tbl_prefix').'doctors');
        
$crud->columns('doctor_image', 'doctor_resume', 'doctor_name', 'phone_number', 'speciality', 'experience','status');
$crud->fields('application_id', 'doctor_image', 'doctor_name', 'street_name', 'zip_code', 'phone_number','landline_number','date_of_birth','country','state','city','speciality','joining_date','experience','doctor_detail', 'doctor_resume','status');
$crud->set_relation('country', $this->config->item('tbl_prefix').'country', 'country_name');
$crud->set_relation('state', $this->config->item('tbl_prefix').'country_regions', 'region_name');
$crud->set_relation_dependency('region_id','country_id','country');
$crud->set_relation('city', $this->config->item('tbl_prefix').'country_region_cities', 'city_name');
$crud->set_relation_dependency('city_id','country_id','city');


xheradon

xheradon
  • profile picture
  • Member

Posted 07 March 2017 - 15:16 PM

/topic/1087-updated-24112012-dependent-dropdown-library/