Form Searching data siswa
kode :
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Data Siswa</title>
<style>
body {
font-family: "Segoe UI", sans-serif;
background: #f4f6fa;
padding: 30px;
}
h1 {
margin-bottom: 20px;
color: #1e3c72;
font-size: 28px;
}
.table-container {
overflow-x: auto;
}
table {
width: 100%;
max-width: 1100px;
border-collapse: collapse;
background: #ffffff;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
/* Header */
table tr:first-child {
background: linear-gradient(135deg, #1e3c72, #2a5298);
color: white;
font-weight: bold;
}
table td {
padding: 14px 12px;
text-align: center;
border-bottom: 1px solid #eee;
font-size: 14px;
}
table tr:hover:not(:first-child) {
background: #f0f6ff;
transition: 0.3s;
}
button {
padding: 7px 14px;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 13px;
font-weight: 600;
transition: 0.3s;
}
.btn-edit {
background: #f9b233;
color: white;
}
.btn-edit:hover {
background: #e0a021;
}
.btn-hapus {
background: #e74c3c;
color: white;
}
.btn-hapus:hover {
background: #c0392b;
}
a {
text-decoration: none;
}
@media (max-width: 768px) {
table td {
font-size: 12px;
}
button {
margin-bottom: 5px;
}
}
</style>
</head>
<body>
<h1>Data Siswa</h1>
<form method="get" action="">
<input type="hidden" name="page" value="DataSiswa">
<input type="text" name="kata_kunci" class="input input-search">
<input type="submit" value="cari" class='btn btn-search'>
</form>
<table>
<tr>
<td>NIS</td>
<td>Nama Siswa</td>
<td>Jenis Kelamin</td>
<td>Tempat Lahir</td>
<td>Tanggal Lahir</td>
<td>Nama Ibu Kandung</td>
<td>Aksi</td>
</tr>
<?php
include"conn/config.php";
if(!isset($_GET['kata_kunci']))
{ $perintah="select * from tb_siswa"; }
else
{
$kata_kunci=$_GET['kata_kunci'];
$perintah="select * from tb_siswa WHERE
nis='$kata_kunci' OR
nama='$kata_kunci' OR
jenis_kelamin='$kata_kunci' OR
tempat_lahir='$kata_kunci' OR
tanggal_lahir='$kata_kunci' OR
nama_ibukandung='$kata_kunci'";
}
$query=mysqli_query($koneksi,$perintah);
while ($data = mysqli_fetch_row($query)) {
echo "
<tr>
<td>$data[0]</td>
<td>$data[1]</td>
<td>$data[2]</td>
<td>$data[3]</td>
<td>$data[4]</td>
<td>$data[5]</td>
<td>
<a href='form_ubahsiswa.php?nis=$data[0]'>
<button class='btn-edit'>Ubah</button>
</a>
<a href='hapus_siswa.php?nis=$data[0]'
onclick=\"return confirm('Yakin ingin menghapus data ini?')\">
<button class='btn-hapus'>Hapus</button>
</a>
</td>
</tr>";
}
?>
</table>
</div>
</body>
</html>
Hasil :
Komentar
Posting Komentar