For this, you could use AJAX. In your country dropdown box, just echo all the countries in <option>
elements.
Then attach a change
event on this dropdown box using jQuery, so that it will take the user’s input (I mean selected country) and do an AJAX request(jQuery has various shorthand methods for AJAX too) to fetch all the provinces belonging to this country. So this request will be sent to a PHP page on your site, that will pull the details from your db using the country id that the user selected.
Then the result from the AJAX request, which would be list of provinces with their IDs is dynamically appended to the second dropdown box(ie. for province). And for this province dropdown box also you would attach a change
event to it, and do the similar thing like I mentioned above to fetch all the cities under this province, using AJAX.
Do a quick research on AJAX, in Google. There are lots of tutorials to help you.
1
solved post value one dropdown to other dropdown using php mysql