Dynamic Drop Down Box From Mysql September 28, 2023 Post a Comment I got 3 input fields and each field are getting their data from its own tables called Tour type, country and destination respectively as shown Tour TypeSolution 1: Please go through this link dependent dropdown using jquery ajaxHow he maintained the relations among the entitieslet me explain you if you want countries based on tour then you need to relate the country table with tour table as you have shown the country table in image it contains only two columns countries_id and countries_name you have to add one more column that is tour_type_id when you select any tour you will get the tour_type_id then your query should be SELECT*FROM `countries` where `tour_type_id` =1//this is the id you will getfrom the tour_type select box Copyand this will populate the related countries same case for the destination related this table with country_idHope it makes senseSolution 2: as i am an asp.net developer i can suggest you put your 2nd and 3rd drop down in an update panel(ajax update panels) then in your 2nd drop down query make it like $sql=mysql_query("Select countries_id,countries_name from countries where tour_type_id="+element_11.SelectedItem.Value+""); it will select those values whose tour_type_id is same as you selected in first drop down, same logic can be use in 3rd drop down as wellSolution 3: There are two ways to sole this.. you can use use php with a page refresh and 2nd way use jQuery ajax to populate fields accordingly. Share Post a Comment for "Dynamic Drop Down Box From Mysql"
Post a Comment for "Dynamic Drop Down Box From Mysql"