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

	$sql = "INSERT INTO keluhan(tanggal, id_pengguna, keluhan, harapan, balasan, status_admin, status_pengguna)
	VALUES(NOW(), '" . $id_pengguna . "', '" . $keluhan . "', '" . $harapan . "', '', 0, 0)";
	$result = mysqli_query($koneksi, $sql);
	if ($result) {
		$response["success"] = 1;
		$response["message"] = "Keluhan Berhasil Dikirim";
		echo json_encode($response);
	} else {
		$response["success"] = 0;
		$response["message"] = "Keluhan Gagal Dikirim";
		echo json_encode($response);
	}
} else {
	$response["success"] = 0;
	$response["message"] = "Keluhan Gagal Dikirim";
	echo json_encode($response);
}
