I am using this code and am able to get it to work with my database for the first two option. I have soccer data, and the first dropdown I select the league, then based on that, the second dropdown populates with teams based on what league they are in; this is to select the home team. I am trying to add a 3rd dropdown which also populates with teams based on the league, which would be the away team.

I have two issues:
...