Dynamic Drop Down Box From Mysql January 29, 2024 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 senseBaca JugaHow To Send An Html Form To An EmailForm Not Posting ValuesSet Tables As Side By Side Instead Of Straight Down While Doing A While-loopSolution 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 You may like these postsWhen Coding Html, Browser Doesn't Always Detect ChangesSubmit Button Needs To Be Clicked Twice To Get My Results From Radio Buttons In A Php ScriptPhp Curl Get Html And Js RenderStop The Video When Play Another Video Post a Comment for "Dynamic Drop Down Box From Mysql"
Post a Comment for "Dynamic Drop Down Box From Mysql"