-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
71 lines (57 loc) · 1.82 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
<?php
require 'function.php';
$mahasiswa = query("SELECT * FROM mahasiswa");
if(isset($_POST["cari"])){
$mahasiswa = cari($_POST["keyword"]);
}
?>
<!DOCTYPE html>
<html leng = "en">
<head>
<title> Document </title>
<script type="text/javascript" src="js/bootstrap.js"></script>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
</head>
<body>
<h1> Daftar Mahasiswa </h1>
<br>
<table border = "1" cellpadding = "10" cellspacing = "0" class="table table-bordered">
<thead>
<tr>
<th>No.</th>
<th>Nama</th>
<th>Nim</th>
<th>Email</th>
<th>Jurusan</th>
<th>Gambar</th>
<th>Aksi</th>
</tr>
</thead>
<!-- //kita biat contoh data static -->
<?php $i=1 ?>
<?php foreach ($mahasiswa as $row): ?>
<tr>
<td><?= $i; ?></td>
<td><?= $row["Nama"];?></td>
<td><?= $row["Nim"];?></td>
<td><?= $row["Email"];?></td>
<td><?= $row["Jurusan"];?></td>
<td> <img src="img/<?php echo $row["Gambar"]; ?>" alt="" srcset="" width=100 height=50></td>
<td>
<a href = "edit.php?id=<?php echo $row["id"];?>"> Edit </a>
<a href = "hapus.php?id=<?php echo $row["id"]; ?>"onclick="return confirm('Apakah data ini akan dihapus?')">Hapus </a>
</td>
</tr>
<?php $i++ ?>
<?php endforeach;?>
</table>
<form class="form-inline" action="" method="post">
<div class="form-group">
<input type="text" name="keyword" size="40" autofocus placeholder="Masukan keyword pencarian" autocomplete="off">
</div>
<button type="submit" class="btn btn-primary" name="cari">Cari</button>
</form>
<br>
<a href="tambah_data.php" class="btn btn-primary">Tambah data mahasiswa</a>
</body>
</html>