服务器端:server.php
1 <?php
2 include('dbconfig.php');
3
4
5 $address = $_POST['address'];
6 $longitude = $_POST['longitude'];
7 $latitude = $_POST['latitude'];
8
9
10 if(empty($address) or empty($longitude) or empty($latitude)){
11 die("You have to fill all the fields!");
12 }
13 $conn = mysql_connect($server,$username,$password);
14 if(!$conn){
15 die("connection failed:".mysql_error());
16 }
17
18 mysql_select_db($dbName,$conn);
19
20 $query = "insert into ".$tableName." values(NULL,'".$address."',".$longitude.",".$latitude.",'".date('Y-m-d H:i:s',time())."');";
21 $result = mysql_query($query,$conn);
22 if(!$