Hi Guys,
I want to include the iphone gps long and lat into my website to be added to a sql query.
Gets GPS long and lat from iphone and pops it in a div:
[CODE]<html>
<head>
<script type=”text/javascript”>
function getGPS() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showGPS, gpsError);
} else {
gpsText.innerText = “No GPS Functionality.”;
}
}
function gpsError(error) {
alert(“GPS Error: “+error.code+”, “+error.message);
}
function showGPS(position) {
gpsText.innerText = “Latitude: “+position.coords.latitude+”nLongitude: “+position.coords.longitude;
// alternate
//gpsText.innerHTML = “<a href=’http://maps.google.com/maps?q=”+position.coords.latitude+”,”+position.coords.longitude+”+(Your+Location)&iwloc=A&z=17′>”+position.coords.latitude+”,”+position.coords.longitude+”</a>”;
}
</script>
</head>
<body>
<a href=# onclick=”getGPS()”>Get GPS Data</a>
<div id=gpsText></div>
</body>
</html>
I want this to work like a tracking system where it gets the gps long and lat from the iphone and then adds it to a sql table (id, user_id, long, lat).
I have the code to get the long and lat but how do i get the script to add them to a sql query from java?
Also how can i get the script to refresh every 15 mins to overwrite the last long and lat?
Im running PHP and javascript
Thanks
Adam