In this section, we will detect geolocation support, use the Geolocation API to obtain the user's coordinates (if we can), save the coordinates to MySQL via our PHP callback, and handle any errors that might occur.
Make sure you've set up the required files in the previous section:
index.php to serve the main page,
callback.php to serve as our callback, and
feed.php to serve as our KML feed. In this section, we will be concentrating on
Perform the following steps for getting the user's location:
lib.phpas discussed here. This will be the file that handles connections to the database for all components in the system.