-
Notifications
You must be signed in to change notification settings - Fork 0
/
readCity.php
26 lines (25 loc) · 887 Bytes
/
readCity.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
<?php
require_once("dbcontroller.php");
$db_handle = new DBController();
#var_dump($_POST);
$state = $_POST["state"];
#echo $state;
#if(empty($state){
# echo "Not state";
#}
if(!empty($_POST["keyword"])) {
$query ="SELECT City FROM ZIPCodes WHERE (State = '$state' and City like '" . $_POST["keyword"] . "%') Group BY City LIMIT 0,6";
#$query ="SELECT City FROM ZIPCodes WHERE State = . $_POST["state"] . Group BY City LIMIT 0,6";
#$query ="SELECT City FROM ZIPCodes WHERE State = '$state' Group BY City LIMIT 0,6";
#$query ="SELECT City FROM ZIPCodes WHERE ( City like '" . $_POST["keyword"] . "%') Group BY City LIMIT 0,6";
$result = $db_handle->runQuery($query);
if(!empty($result)) {
?>
<ul id="city-list">
<?php
foreach($result as $city) {
?>
<li onClick="selectCity('<?php echo $city["City"]; ?>');"><?php echo $city["City"]; ?></li>
<?php } ?>
</ul>
<?php } } ?>