-
Notifications
You must be signed in to change notification settings - Fork 0
/
ruang_tambah.php
72 lines (67 loc) · 2.09 KB
/
ruang_tambah.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
62
63
64
65
66
67
68
69
70
71
72
<?php
//berkas sistem
require_once './app/config.php';
require_once './app/database.php';
require_once './app/fungsi.php';
_isLogin();
_isLevel([1]);
$error = 0;
$tambah = filter_input(INPUT_POST, 'tambah', FILTER_SANITIZE_STRING);
if (!empty($tambah)) {
$kode_ruang = filter_input(INPUT_POST, 'kode_ruang', FILTER_SANITIZE_STRING);
$nama_ruang = filter_input(INPUT_POST, 'nama_ruang', FILTER_SANITIZE_STRING);
$keterangan = filter_input(INPUT_POST, 'keterangan', FILTER_SANITIZE_STRING);
$simpan = db_ruang_add($db_conn, $kode_ruang, $nama_ruang, $keterangan);
if ($simpan > 0) {
//berhasil menyimpan data
header('Location: ./ruang.php');
} else {
$error = 1;
}
}
?>
<html>
<head>
<title>Tambah Data Ruang</title>
</head>
<body>
<p><a href="./index.php">Home</a> > <a href="./ruang.php">Ruang</a> > Tambah Ruang</p>
<form action="" method="post">
<table>
<tr>
<td>Kode Ruang</td>
<td>:</td>
<td>
<input type="text" name="kode_ruang" required autofocus>
</td>
</tr>
<tr>
<td>Nama Ruang</td>
<td>:</td>
<td>
<input type="text" name="nama_ruang" required>
</td>
</tr>
<tr>
<td>Keterangan</td>
<td>:</td>
<td>
<textarea name="keterangan"></textarea>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<input type="submit" name="tambah" value="Tambah">
</td>
</tr>
</table>
<?php
if ($error == 1) :
echo '<p>Kesalahan dalam menyimpan data kedalam database.</p>';
endif;
?>
</form>
</body>
</html>