-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetch_adm_data.php
34 lines (26 loc) · 1.36 KB
/
fetch_adm_data.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
<?php
include 'includes/config.php';
include 'admFetchFunc.php';
header('Content-Type: application/json');
$inputData = json_decode(file_get_contents('php://input'), true);
$admType = $inputData['admType'];
$adm1selectedValue = $inputData['adm1Selected'];
$adm2selectedValue = $inputData['adm2Selected'];
$adm3selectedValue = $inputData['adm3Selected'];
$iso = $inputData['iso'];
if ($admType == "***") {
$responseDataAdm1 = fetchAdmData('adm1', $iso, $adm1selectedValue, $adm2selectedValue, $adm3selectedValue);
$responseDataAdm2 = fetchAdmData('adm2', $iso, $adm1selectedValue, $adm2selectedValue, $adm3selectedValue);
$responseDataAdm3 = fetchAdmData('adm3', $iso, $adm1selectedValue, $adm2selectedValue, $adm3selectedValue);
$return = ["array1"=>$responseDataAdm1, "array2"=>$responseDataAdm2, "array3"=>$responseDataAdm3];
}
if ($admType == "adm1") {
$responseDataAdm2 = fetchAdmData($admType, $iso, $adm1selectedValue, $adm2selectedValue, $adm3selectedValue);
$responseDataAdm3 = fetchAdmData("adm2", $iso, $adm1selectedValue, $adm2selectedValue, $adm3selectedValue);
$return = ["array1"=>$responseDataAdm2, "array2"=>$responseDataAdm3];
} elseif ($admType == "adm2") {
$responseDataAdm3 = fetchAdmData("adm2", $iso, $adm1selectedValue, $adm2selectedValue, $adm3selectedValue);
$return = $responseDataAdm3;
}
echo json_encode($return);
?>