justineaguas Posted July 14, 2010 Share Posted July 14, 2010 Okay, I know this is an old question but I can't find good tutorials in the internet (or I'm just really the problem). Anyway, I am creating a page wherein there are 2 dropdown boxes, each of these two gets their content from the database. As the user changes the first dropdown box, the choices in the second dropdown box would change depending on the selection on the first dropdown. Here are the tables to be used. TABLE 1 - First dropdown CategoryID | CategoryName 1 | Candies 2 | Meat 3 | Seafood TABLE 2 - Second dropdown SecondCategoryID | SecondCategoryName | CategoryID 1 | Gummy Bears | 1 2 | Steak | 2 3 | Fish | 3 For example, I chose Candies in the first dropdown box, the second dropdown box would show the rows in the TABLE 2 with the CategoryID 1 and so on.. I've been searching different tutorials from the internet and from youtube but somehow I can't seem to do it with those tutorials. I know that this is possible with PHP and JS but I really need help. Thanks for future help. Quote Link to comment https://forums.phpfreaks.com/topic/207710-dynamic-dropdown-with-mysql-database/ Share on other sites More sharing options...
DaiLaughing Posted July 17, 2010 Share Posted July 17, 2010 It seems to be fundamental AJAX. Just use a request to get the content and use Javascript to populate the drop down. If you don't "get" AJAX that might seem hard but it's not. Do an AJAX tutorial and you'll have it sorted quickly. Quote Link to comment https://forums.phpfreaks.com/topic/207710-dynamic-dropdown-with-mysql-database/#findComment-1087435 Share on other sites More sharing options...
PravinS Posted July 17, 2010 Share Posted July 17, 2010 Try this http://www.phpclasses.org/package/5988-PHP-Retrieve-MySQL-query-results-into-arrays.html Quote Link to comment https://forums.phpfreaks.com/topic/207710-dynamic-dropdown-with-mysql-database/#findComment-1087437 Share on other sites More sharing options...
Nadiki Posted July 18, 2010 Share Posted July 18, 2010 Well, here's a link in Spanish, I helped me a lot, there are still things to improve here, but it is a good to begin... (sorry my english is very bad) http://www.tallerwebmaster.com/tutorial/listas-dinamicas-enlazadas/77/ espero te sirva como me sirvió a mi ... Nadiki Quote Link to comment https://forums.phpfreaks.com/topic/207710-dynamic-dropdown-with-mysql-database/#findComment-1087663 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.