-
Notifications
You must be signed in to change notification settings - Fork 0
/
populate_update_event.php
35 lines (30 loc) · 988 Bytes
/
populate_update_event.php
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
<?php
include 'connect.php';
header('Content-type: application/json');
// FILE UNTUK POPULATE ISI FORM UNTUK UPDATE
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// Ambil info dari Ajax
$checkedIdEvent = $_POST['checkedIdEvent'];
// SQL untuk ambil id event, nama event, jenis event, tempat event, dan link event
$sql = "SELECT e.id AS id_event,
e.nama AS nama,
e.jenis AS jenis,
e.tempat AS tempat,
e.link AS link
FROM event AS e
WHERE id = ?
LIMIT 1";
$stmt = $pdo->prepare($sql);
$stmt->execute([$checkedIdEvent]);
$data = $stmt->fetch();
$notif = '';
$output = '';
echo json_encode(array(
'output' => $output, 'notif' => $notif,
'id_event' => $data['id_event'],
'nama' => $data['nama'],
'jenis' => $data['jenis'],
'tempat' => $data['tempat'],
'link' => $data['link']
));
}