Jump to content

Dynamic Dropdown with mySQL database.


justineaguas

Recommended Posts

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.