我正试图在jquery建造一个高尔夫球场,在那里,我可以把目前的浮雕坐标送到一个使用纽子的我的SQL数据库。
The problem is that I am new to php and I am trying to find code that i can use. I have built a database:
- ID int 3 autoincrement
- LAT float 10
- LON float 10
一个人能否得到某些html和php代码的帮助?
<!DOCTYPE html>
<html>
<body>
<div data-role="page" id="page1">
<div data-theme="b" data-role="header" data-position="fixed">
<h5>
Play 9 holes
</h5>
</div>
</div>
<p id="demo">Click the button to get your position:</p>
<button onclick="getLocation()">Try It</button>
<div id="mapholder"></div>
<script>
var x=document.getElementById("demo");
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition,showError);
}
else{x.innerHTML="Geolocation is not supported by this browser.";}
}
function showPosition(position)
{
var latlon=position.coords.latitude+","+position.coords.longitude;
var img_url="http://maps.googleapis.com/maps/api/staticmap?center="
+latlon+"&zoom=14&size=400x400&sensor=false";
document.getElementById("mapholder").innerHTML="<img src= "+img_url+" />";
}
function showError(error)
{
switch(error.code)
{
case error.PERMISSION_DENIED:
x.innerHTML="User denied the request for Geolocation."
break;
case error.POSITION_UNAVAILABLE:
x.innerHTML="Location information is unavailable."
break;
case error.TIMEOUT:
x.innerHTML="The request to get user location timed out."
break;
case error.UNKNOWN_ERROR:
x.innerHTML="An unknown error occurred."
break;
}
}
</script>
</body>
</html>
这部法典显示了目前的位置,但必须具备能够向数据库发送立场的要求功能。