-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinsertAlamat.php
More file actions
36 lines (29 loc) · 1 KB
/
insertAlamat.php
File metadata and controls
36 lines (29 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
include_once('koneksi.php');
if (!empty($_POST['customer_id'])) {
$customer_id = $_POST['customer_id'];
$provinsi = $_POST['provinsi'];
$kabupaten = $_POST['kabupaten'];
$kecamatan = $_POST['kecamatan'];
$kelurahan = $_POST['kelurahan'];
$jalan = $_POST['jalan'];
$nomor_rumah = $_POST['nomor_rumah'];
$kode_pos = $_POST['kode_pos'];
$query = "INSERT INTO alamat(customer_id, provinsi, kabupaten, kecamatan, kelurahan, jalan, nomor_rumah, kode_pos) VALUES ('$customer_id', '$provinsi', '$kabupaten', '$kecamatan', '$kelurahan', '$jalan', '$nomor_rumah', '$kode_pos')";
$insert = pg_query($connect, $query);
if ($insert) {
set_response(true, "Success insert alamat");
} else {
set_response(false, "Failed insert alamat");
}
} else {
set_response(false, "Harus diisi");
}
function set_response($isSuccess, $message)
{
$result = array(
'isSuccess' => $isSuccess,
'message' => $message
);
echo json_encode($result);
}