Files
TUGAS-SIG/api/save_place.php
T

19 lines
567 B
PHP

<?php
header('Content-Type: application/json');
require_once __DIR__ . '/config.php';
$conn = getDB();
$name = $_POST['name'];
$lat = $_POST['lat'];
$lng = $_POST['lng'];
$radius = $_POST['radius'];
$type = $_POST['type'];
$address = $_POST['address']; // Capture the address
$stmt = $conn->prepare("INSERT INTO worship_places (name, lat, lng, radius, type, address) VALUES (?, ?, ?, ?, ?, ?)");
$stmt->bind_param("ssdiss", $name, $lat, $lng, $radius, $type, $address);
if ($stmt->execute()) {
echo json_encode(["id" => $conn->insert_id]);
}
?>