-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathajax.php
More file actions
39 lines (28 loc) · 1.28 KB
/
ajax.php
File metadata and controls
39 lines (28 loc) · 1.28 KB
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
<?php
include ('includes/config.inc.php');
$voivodeshipId = isset($_POST['voivodeshipId']) ? $_POST['voivodeshipId'] : 0;
$cityId = isset($_POST['cityId']) ? $_POST['cityId'] : 0;
$categoryId = isset($_POST['categoryId']) ? $_POST['categoryId'] : 0;
$subcategoryId = isset($_POST['subcategoryId']) ? $_POST['subcategoryId'] : 0;
$command = isset($_POST['get']) ? $_POST['get'] : "";
switch ($command) {
case "city":
$result1 = "<option disabled selected>Wybierz miasto...</option>";
$statement = "SELECT * FROM cities WHERE voivodeship_id='$voivodeshipId' ORDER BY city;";
$dt = mysqli_query($conn, $statement);
while ($result = mysqli_fetch_array($dt)) {
$result1 .= "<option value=" . $result['city_id'] . ">" . $result['city'] . "</option>";
}
echo $result1;
break;
case "subcategory":
$result2 = "<option disabled selected>Wybierz podkategorię...</option>";
$statement = "SELECT * FROM subctgrs WHERE ctgr_id='$categoryId';";
$dt = mysqli_query($conn, $statement);
while ($result = mysqli_fetch_array($dt)) {
$result2 .= "<option value=" . $result['subctgr_id'] . ">" . $result['subcategory'] . "</option>";
}
echo $result2;
break;
}
exit(); ?>