I think I can use this method but don't know what to do, I have 2 drop down boxes one is gadget and one is brand, for example if my gadget drop down is empty, then my brand drop down should be empty as well, if I select computer in the gadget drop down, the brand should should drop down should generate a brand of computer brand (example: acer, asus, hp,) then if I pick cellphones it should generate other brand, example (LG, Samsung, Xiaomi, Huawei) something like that, the brand is in a database table and also the gadget also have a database table. Sorry about my English, not my primary language
You can achieve this, using javascript. Here's an example:
Javascript
var gadgetList = ['Cellphone', 'Tablet', 'Kindle'];
select = document.getElementById('gadgets');
for(gadget in gadgetList) {
select.add(new Option(gadgetList[gadget]));
};
HTML
<select id="gadgets"></select>
Take a look at this Repl. It loads data from JSON for two dropdown combos. Gadgets and Devices, Devices is loaded dependant on Gadgets.