PHP mySQL User Location v1.0

Automatically Detect and Set User's Country

Stored Country ----------------- N/A
Stored Country Code -------- N/A

Detected Country ----------------- United States  
Detected Country Code -------- US

*This is a bonus and we are using a third party free service to retrieve some information. We do not control that 3rd party script and are not responsible for its availability in future.

It can detect the visitor's current code. If we have the country code, we can use that to detect and store user's current country from our database. If the visitor's country is detected you will see a button to 'set detected country'. Clicking that button will store the user's current country code and country name in the system. You can also store the detected country as visitor visits the page without any action from visitor.

*This won't work in localhost / local web server. This code needs to be hosted online to work.
*If this page does not detect the country, refresh the page.