<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');
header("Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization");
include '../../../config/index.php';
$data = file_get_contents('php://input');
$obj = json_decode($data, true);
foreach ($obj["parents"] as $key => $parent_id) {
    $sql = "UPDATE parents SET 
        p_refugee='" . $obj['refugeeStatus'] . "',
        disability_status='" . $obj['disability'] . "',
        p_location='" . $obj["location"] . "'
        WHERE parent_id='" . $parent_id . "'";

    if (mysqli_query($conn, $sql)) {
        $parent_id = mysqli_insert_id($conn);
    }
}
$curl_post_data = array(
    'Success' => 'true',
    'parent_id' => $parent_id
);
echo json_encode($curl_post_data);
