Required php JavaScript country state drop down.

Hi,
I am making a JavaScript drop down for country and states. So that user can update their profile. I am facing a problem that after selecting the country & state if the user refreshes the page. Then the selected country remains the same while state get changes. I am searching for the right PHP JavaScript country state code for my website. If you have any idea or correct script, then share it with me.
Thanks
