'Update combo depending on previous combo information

I have this two tables.

id city
1 bogota
2 tunja
id branch cityid
1 sector1 1
2 sector2 2
3 sector3 2
4 sector4 1

now i need to create a way in which the branch select field updates depending on the foreign key of the city

example: my first combo should contain city bogota and the next combo should only show me the list of branches that are part of that particular city.

how to begin?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source