-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
47 lines (38 loc) · 1.24 KB
/
search.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
<?php
include('connection.php');
$keyword = $_GET['keyword'];
$query = mysqli_query($connect, "SELECT * FROM karyawan WHERE nama = '$keyword'");
$results = mysqli_fetch_all($query, MYSQLI_ASSOC);
?>
<html>
<body>
<a href="add .php">Tambah Data</a>
<br/><br/>
<form action="search.php" method="GET">
<input type="text" name="keyword" placeholder="Keyword .." value="<?php echo $_GET['keyword'] ?>" />
<button type="submit">Search</button>
</form>
<br/><br/>
<table border="1">
<tr>
<th>Nama</th>
<th>Alama</th>
<th>Umur</th>
<th>Jenis Kelamin</th>
<th>Pilihan</th>
</tr>
<?php foreach ($results as $result) : ?>
<tr>
<td><?php echo $result['nama'] ?></td>
<td><?php echo $result['alamat'] ?></td>
<td><?php echo $result['umur'] ?></td>
<td><?php echo $result['jenis_kelamin'] ?></td>
<td>
<a href="edit.php?id=<?php echo $result['id'] ?>">Edit</a>
<a href="delete.php?id=<?php echo $result['id'] ?>">Delete</a>
</td>
</tr>
<?php endforeach ?>
</table>
</body>
</html>