view source
http://studydojo.com/maps/travel/
as for php
<?php
// adding a new location to the db
if (isset($_POST['name']))
{
$name = $_POST['name'];
$description = $_POST['description'];
$user_name = $_POST['user_name'];
$user_location = $_POST['user_location'];
$lat = $_POST['lat'];
$long = $_POST['long'];
$address = $_POST['address'];
// generate id
$id = 1;
$result = mysql_query("select max(id) from locations");
if (mysql_num_rows($result) != 0)
{
$row = mysql_fetch_array($result);
$id = $row['max(id)']+1;
}
// sql query to add location
$result = mysql_query("insert into locations (`id`, `name`, `latitude`, `longitude`, `address`, `description`, `user_name`, `user_location`)
values ('$id','$name', '$lat', '$long', '$address', '$description', '$user_name', '$user_location')");
}
if(isset($_POST['delbutton'])=='Delete')
{
//echo "tset<br />";
//echo '<pre>' . print_r($_POST,true) . '</pre>';
//$result = die("A MySQL error has occurred." . mysql_error());
$delete = mysql_query("DELETE FROM locations WHERE locations.id=2") or die(mysql_error());
//echo "Account has been deleted.";
}
?>