-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
55 lines (52 loc) · 2 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
<?php
include 'koneksi.php';
?>
<html>
<head>
</head>
<body>
<form action="" method="post">
<label>cari : </label>
<select name="pilihan" id="pilihan">
<option value="nis">nis</option>
<option value="nama">nama</option>
<option value="jenis_kelamin">Jenis_kelamin</option>
</select>
<input type="text" id="username" name="kolomcari" />
<button type="submit" id="btncari" name="btncari"> cari</button>
</form>
<!--table-->
<table border="1" class="data-tabel" cellpadding="0">
<thead >
<tr>
<th>NO</th>
<th>Nis</th>
<th>Nama Siswa</th>
<th>Jenis Kelamin</th>
</tr>
</thead>
<tbody>
<?php
if(isset($_POST['btncari'])){
$cari = $_POST['kolomcari'];
$kategori = $_POST['pilihan'];
$data=mysqli_query($db, "SELECT nis, nama, jenis_kelamin from siswa where $kategori like '%".$cari."%' or jenis_kelamin like '%".$cari."%'");
}else{
$data=mysqli_query($db, "SELECT nis, nama, jenis_kelamin from siswa ");
}
$no=1;
while($siswa = mysqli_fetch_array($data)){
?>
<tr>
<td><?php echo $no++; ?></td>
<td><?php echo $siswa['nis'];?></td>
<td><?php echo $siswa['nama'];?></td>
<td><?php echo $siswa['jenis_kelamin'];?></td>
</tr>
<?php
} ?>
</tbody>
</table>
<!--penuutup table-->
</body>
</html>