/
search_result.php
executable file
·51 lines (49 loc) · 1.63 KB
/
search_result.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
require_once("config.php");
?>
<?php header('Content-type: text/html; charset=utf-8'); ?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html>
<head>
<?php require_once("css.php"); ?>
</head>
<body>
<?php
require_once("GPlaceAPI.php");
$place = new GPlaceAPI();
$lat = $_POST['lat'];
$lng = $_POST['lng'];
$userId = $_POST['user_id'];
if ($lat==""){
die("Your device does not support GPS, or you did not allow application using location information");
}
if (!array_key_exists('search_key',$_POST)){
$searchResult = $place->searchBusiness("",$lat,$lng);
}
else{
$searchResult = $place->searchBusiness($_POST['search_key'],$lat,$lng);
}
$listResult = $searchResult["results"];
?>
<form action="search_result.php" method="post">
<input type="hidden" name="lat" id="lat" value="<?php echo $lat; ?>" >
<input type="hidden" name="lng" id="lng" value="<?php echo $lng; ?>">
<input type="hidden" name="user_id" id="user_id" value="<?php echo $userId; ?>">
<br />
<input type="text" name="search_key" id="search_key" >
<input type="submit" value="Search" >
<form>
<?php
echo '<table>';
$count =1;
foreach ($listResult as $i => $value) {
echo '<tr>';
echo "<td><a href='checkin.php?place_id=" . $value['id'] . "&reference=" . $value['reference'] ."&lat=" . $value['geometry']['location']['lat'] ."&lng=" . $value['geometry']['location']['lng'] ."&uid=" . $userId . "'>" . $value['name'] . "</a></td>";
echo '</tr>';
if ($count++ > 9)
break;
}
echo '</table>';
?>
</body>
</html>