-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
106 lines (88 loc) · 3.87 KB
/
index.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
require 'koneksi.php';
$mahasiswa = query("SELECT * FROM datamahasiswa");
// tombol cari ditekan
if(isset($_POST["search"])){
$mahasiswa = search($_POST["keyword"]);
}
?>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Halaman Admin</title>
</head>
<body>
<div class="container">
<h1 class="alert alert-info text-center">Daftar Mahasiswa</h1>
<div class="row mb-3">
<div class="col-md-6">
<a href="insert.php">
<button class="btn btn-primary">Tambah Data Mahasiswa</button>
</a>
</div>
<div class="col-md-6">
<form action="" method="post" class="d-flex">
<input type="text" name="keyword" autofocus placeholder="Masukkan keyword pencarian..." class="form-control me-2" aria-label="search" autocomplete="off">
<button type="submit" name="search" class="btn btn-outline-primary">Search</button>
</form>
</div>
</div>
<table class="table table-bordered table-hover">
<thead class="text-center table-dark">
<tr>
<th scope="col">No. Urut</th>
<th scope="col">Aksi</th>
<th scope="col">NIM</th>
<th scope="col">Nama</th>
<th scope="col">Email</th>
<th scope="col">Jurusan</th>
<th scope="col">Kelas</th>
<th scope="col">Jenis Kelamin</th>
<th scope="col">Alamat</th>
</tr>
</thead>
<tbody>
<?php $i = 1; ?>
<?php foreach ( $mahasiswa as $row ) : ?>
<tr>
<td scope="row" class="text-center"><?= $i; ?></td>
<td>
<a href="update.php?id=<?= $row["id"]; ?>">
<button class="btn btn-success btn-sm">Ubah</button>
</a>
<a href="delete.php?id=<?= $row["id"]; ?>"
onclick="return confirm('Apakah Data Ini Akan Dihapus?');">
<button class="btn btn-danger btn-sm">Hapus</button>
</a>
</td>
<td><?= $row["nim"]; ?></td>
<td><?= $row["nama"]; ?></td>
<td><?= $row["email"]; ?></td>
<td><?= $row["jurusan"]; ?></td>
<td><?= $row["kelas"]; ?></td>
<td><?= $row["jeniskelamin"]; ?></td>
<td><?= $row["alamat"]; ?></td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>
</tbody>
</table>
<footer class="text-center">
<p>Copyright © 2021 Gak Eror Gak Asik</p>
</footer>
</div>
<!-- Optional JavaScript; choose one of the two! -->
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
<!-- Option 2: Separate Popper and Bootstrap JS -->
<!--
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-IQsoLXl5PILFhosVNubq5LC7Qb9DXgDA9i+tQ8Zj3iwWAwPtgFTxbJ8NT4GN1R8p" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-cVKIPhGWiC2Al4u+LWgxfKTRIcfu0JTxR+EQDz/bgldoEyl4H0zUF0QKbrJ0EcQF" crossorigin="anonymous"></script>
-->
</body>
</html>