• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dropdown search filter in codeigniter

#1
I have a select like this where options_values_57 is string with countries, and options_values_59 is string with cities... i want to make when 1 country selected from options_values_57 then citys for this country to be avible for select if not selected then hide select options_values_59 like When click Romania there show only Romania citys when Click UK there show only UK cities.

PHP Code:
 <select id="search_option_57" class="span3 selectpicker nomargin" placeholder="{options_name_57}">
 
               {options_values_57}
 
 </select>
 
 <select id="search_option_59" class="span3 selectpicker nomargin" placeholder={options_name_59}">
                {options_values_59}
  </select> 
Reply

#2
You want to use AJAX to do this. Here's a tutorial I found with a quick google search: http://www.webdevdoor.com/javascript-aja...query-php/

I didn't study that tutorial very closely, but if that doesn't work for you, you should be able to find another. Just google something like "populate select list with Ajax".

I'd recommend using JQuery as it will make things easier on you in the long run and you will probably find plenty of JQuery examples.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.