<?php
include "koneksi.php";
$response = array();
if(isset($_POST['id_keluhan'], $_POST['balasan'])){
  $id_keluhan = $_POST['id_keluhan'];
  $balasan = $_POST['balasan'];

  $sql = "UPDATE keluhan SET balasan='".$balasan."' WHERE id_keluhan='".$id_keluhan."'";
  $result = mysqli_query($koneksi, $sql);
  if($result){
    $response["success"] = $id_keluhan;
    $response["message"] = "Balasan berhasil dikirim";
    echo json_encode($response);
  } else {
    $response["success"] = 0;
    $response["message"] = "Balasan gagal dikirim";
    echo json_encode($response);
  }
} else {
  $response["success"] = 0;
  $response["message"] = "Balasan gagal dikirim";
  echo json_encode($response);
}
?>
