Here is a JS that can realize your function. You can download JS and follow the instructions.
Another method is to save all provinces and cities in the database, find out and display provinces when opening the webpage, and change the associated cities when selecting provinces. Of course, there are two ways, one is to use ajax, and the other is to find out all the JS codes when opening a webpage, and then modify them, each with its own advantages and disadvantages, depending on you.
If you use JS above, the provinces and cities saved in the database are saved in Chinese characters, and because it is JS code, it is a bit troublesome to maintain, but these things are basically fixed; With the database, provinces and cities can save it in the form of open code (for example, Beijing can use 1, Tianjin 2), which is relatively easy to maintain. Let's do it ourselves.