populate dropdown on selection of other dropdown

前端 未结 4 624
一整个雨季
一整个雨季 2020-12-12 05:32

I have two drop-down boxes. I want to populate second drop-down box on selection in the first drop-down box. My values are retrieving from database. Is this possible withou

4条回答
  •  难免孤独
    2020-12-12 05:41

    Yes you can do it without using php. For that you've to assign two different states list in Javascript array and base on the selection just change the options in the other select box. As simple as that.

    You can assign the javascript array using your serverside scripting language while loading the page if you're using database to store the states.

    But do not do this unless you've very small amount data. In your case you've only 2 countries so you can go ahead with it.

提交回复
热议问题