Sometimes, we have a requirement to make another element dependent on another element selection.
For example, when you go for the Registration to the website when you select a country according to that State Dropdown is filled.
You can do this with only PHP but it required you to submit every time on selection.
This solves your problem but it is little frustrating because it submits every time even if the selection is right or wrong and this is not every user-friendly.
For making it better you can use AJAX with jQuery it loads new data and removes old one on each selection.
What in the Demonstration ?
Creating a Department drop-down list and based on the option selection show all existing users of that department on another Dropdown.