Files
geo.pi.techtube.pl/templates/edit.php

71 lines
2.0 KiB
PHP

<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<title>Geo lokalizator</title>
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<?php include_once "style.php"; ?>
<script type="text/javascript">
function showLocation(position) {
var latitude = position.coords.latitude;
var longitude = position.coords.longitude;
document.getElementById('szer').value = latitude;
document.getElementById('dl').value = longitude;
}
function errorHandler(err) {
if (err.code == 1) {
alert("Error: Access is denied!");
}
else if (err.code == 2) {
alert("Error: Position is unavailable!");
}
}
function getLocation() {
if (navigator.geolocation) {
// timeout at 60000 milliseconds (60 seconds)
var options = {timeout: 60000, enableHighAccuracy: true};
navigator.geolocation.getCurrentPosition(showLocation, errorHandler, options);
}
else {
alert("Sorry, browser does not support geolocation!");
}
}
</script>
</head>
<body>
<h1>Edycja wpisu</h1>
<form action="/save/<?= $entry['id']; ?>" method="POST">
<label>Tytuł</label>
<input type="text" name="title" id="title" value="<?= $entry['title']; ?>"/>
<label>Treść </label>
<textarea name="desc" id="desc"><?= $entry['description']; ?></textarea>
<label>Szerokość geo</label>
<input type="text" name="szer" id="szer" value="<?= $entry['szer']; ?>"/>
<label>Długość geo</label>
<input type="text" name="dl" id="dl" value="<?= $entry['dl']; ?>"/>
<input type="button" onclick="getLocation();" value="Get Location"/>
<button type="submit" name="submit">Wyślij</button>
</form>
<a href="/list">List</a>
</body>
</html>