-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpegawai-view.php
61 lines (57 loc) · 1.66 KB
/
pegawai-view.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
$id = $_GET['id'] ?? 0;
// ambil data pegawai dari database
// kemudian simpan ke array $data
$sql = "select * from pegawai where id = ?";
// prepare sql statement
$stmt = mysqli_prepare($db_conn, $sql);
// bind parameter to prevent sql injection
mysqli_stmt_bind_param($stmt, 'd', $id);
// execute sql statement
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $id, $nip, $nama, $alamat, $tempat_lahir, $tanggal_lahir);
// tampilkan data pegawai
if ($row = mysqli_stmt_fetch($stmt)):
?>
<h3>View Pegawai</h3>
<form id="frmPegawai" name="frmPegawai" action="pegawai-proses.php" method="post">
<table cellpadding="2" cellspacing="1" border="1">
<tr>
<th>NIP</th>
<td><?php print $nip; ?></td>
</tr>
<tr>
<th>Nama</th>
<td><?php print $nama; ?></td>
</tr>
<tr>
<th>Alamat</th>
<td><?php print $alamat; ?></td>
</tr>
<tr>
<th>Tempat Lahir</th>
<td><?php print $tempat_lahir; ?></td>
</tr>
<tr>
<th>Tanggal Lahir</th>
<td><?php print $tanggal_lahir; ?></td>
</tr>
<tr>
<th colspan="2">
<?php if ($_GET['action']=='delete'): ?>
<input type="submit" name="btnHapusPegawai" value="Hapus" style="width: 100px;" />
<input type="hidden" name="id" value="<?php print $id; ?>" />
<input type="hidden" name="action" value="delete" />
<?php endif; ?>
<a href="index.php?f=pegawai-list">Kembali ke Daftar Pegawai</a>
</th>
</tr>
</table>
</form>
<?php
// end if
endif;
// clean up memory
mysqli_stmt_close($stmt);