-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtambah.php
63 lines (52 loc) · 1.46 KB
/
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
<?php
/**
* PHP CRUD DASAR
* Author : Irawan Kilmer
* Email : irawankillmer@gmail.com
* WhatsApp : 082318009200
*/
require_once 'header.php';
if (isset($_POST['tambah'])) {
// Check apakah nisn sudah terdaftar
if (check('nisn', $_POST['nisn']) > 0) {
echo "
<script>
alert('Mohon maaf Nisn sudah terdaftar!')
</script>
";
} else {
// Check apakah Nis sudah terdaftar
if (check('nis', $_POST['nis']) > 0) {
echo "
<script>
alert('Mohon maaf Nis sudah terdaftar!')
</script>
";
} else {
// Jalankan Query
insertData($_POST);
}
}
}
?>
<h1>Tambah Data Siswa</h1>
<hr>
<a class="btn btn-sm btn-danger" href="index.php">Batal</a>
<br>
<br>
<form action="" method="POST">
<div class="mb-3">
<label for="nisn" class="form-label">nisn</label>
<input type="text" class="form-control" id="nisn" required name="nisn">
</div>
<div class="mb-3">
<label for="nis" class="form-label">nis</label>
<input type="text" class="form-control" id="nis" required name="nis">
</div>
<div class="mb-3">
<label for="nama" class="form-label">nama</label>
<input type="text" class="form-control" id="nama" required name="nama">
</div>
<button type="submit" class="btn btn-sm btn-primary" name="tambah">Tambah</button>
</form>
<?php require_once 'footer.php'; ?>