connect_error) {
die("Koneksi Gagal: " . $conn->connect_error);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$type = $_POST['type'];
$nama_atribut = $_POST['nama_atribut'];
$status = $_POST['status'];
$hasil_hitung = $_POST['hasil_hitung'];
$geojson = $_POST['geojson']; // String GeoJSON dari Leaflet
if ($type == 'jalan') {
$sql = "INSERT INTO data_jalan (nama_jalan, status_jalan, panjang_meter, geojson)
VALUES ('$nama_atribut', '$status', '$hasil_hitung', '$geojson')";
} else if ($type == 'parsil') {
$sql = "INSERT INTO data_parsil (kode_kavling, status_kepemilikan, luas_meter, geojson)
VALUES ('$nama_atribut', '$status', '$hasil_hitung', '$geojson')";
}
if ($conn->query($sql) === TRUE) {
echo "";
} else {
echo "Error: " . $sql . "
" . $conn->error;
}
}
$conn->close();
?>