This topic is locked

insert co-ordinates into database fields

4/9/2023 6:56:55 AM
PHPRunner General questions
P
pmuckle authorDevClub member

Hello,
I am using this code in Javascript OnLoad event:
`if (navigator.geolocation) {

navigator.geolocation.getCurrentPosition(showPosition);

}

function showPosition(position) {

alert("Latitude: " + position.coords.latitude +

" Longitude: " + position.coords.longitude);

}`This works and the coordinates are shown in the dialog.
How do I insert the coords into database fields 'latitude' and 'longitude'?
Thanks
Pete

fhumanes 4/9/2023

Hi Pete,
I have made a plugin that does exactly what you ask.
The plugins page is: https://fhumanes.com/blog/guias-desarrollo/plugines-de-phprunner/
And the plugin is called "Geolocation"
Greetings,
fernando

admin 4/10/2023
P
pmuckle authorDevClub member 4/13/2023

Thanks both,
Fernando, what code can I use to split the data and put it into 'latitude' and 'longitude' fields please.
Thanks for any help
Pete