Sometimes it requires to auto populate data on the element based on selection on another element e.g. City names based on a state.
You can do this with the 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.
For making it better you can use AJAX with jQuery that loads new data and removes old one on each selection.
In the demonstration, I am creating a Department drop-down list and based on the option selection show all existing users of that department on another Dropdown.