1st commit: version 1.0 WebGis-Pemetaan-Kemiskinan
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
header("Content-Type: application/json; charset=UTF-8");
|
||||
header("Access-Control-Allow-Methods: POST");
|
||||
require_once '../koneksi.php';
|
||||
|
||||
$data = json_decode(file_get_contents("php://input"));
|
||||
if (!empty($data->id_anggota) && !empty($data->id_pelatihan)) {
|
||||
try {
|
||||
$stmt = $conn->prepare("INSERT INTO log_pelatihan (id_anggota, id_pelatihan) VALUES (:ida, :idp)");
|
||||
$stmt->bindValue(':ida', $data->id_anggota, PDO::PARAM_INT);
|
||||
$stmt->bindValue(':idp', $data->id_pelatihan, PDO::PARAM_INT);
|
||||
if($stmt->execute()) echo json_encode(["pesan" => "Berhasil didaftarkan ke program pelatihan!"]);
|
||||
} catch(PDOException $e) {
|
||||
http_response_code(500); echo json_encode(["error" => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user