0% found this document useful (0 votes)
1 views5 pages

Menampilkan Hasil Esp32 Ke Database Mysql Arduino

This document is a PHP script for a school attendance system that displays a list of students. It includes functionalities for editing and deleting student records, as well as a user interface with navigation buttons and alerts for success or error messages. The layout is styled with CSS for a clean and organized presentation of the student data in a table format.

Uploaded by

husnigodev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views5 pages

Menampilkan Hasil Esp32 Ke Database Mysql Arduino

This document is a PHP script for a school attendance system that displays a list of students. It includes functionalities for editing and deleting student records, as well as a user interface with navigation buttons and alerts for success or error messages. The layout is styled with CSS for a clean and organized presentation of the student data in a table format.

Uploaded by

husnigodev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

// Cek jika ada pesan dari proses edit atau hapus siswa

if (isset($_GET['status']) && isset($_GET['message'])) {


$status = $_GET['status'];
$message = $_GET['message'];
$message_type = ($status == "success") ? "success" : "error";
}

// Query untuk mengambil semua data siswa


$sql = "SELECT * FROM siswa ORDER BY nis ASC";
$result = $conn->query($sql);
?>

<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Daftar Siswa - Sistem Absensi Sekolah</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-
awesome/6.4.0/css/all.min.css">
<style>
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
color: #333;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.header {
background-color: #2c3e50;
color: white;
padding: 20px 0;
text-align: center;
border-radius: 8px 8px 0 0;
margin-bottom: 20px;
display: flex;
justify-content: center;
align-items: center;
}
.logo {
width: 80px;
height: 80px;
margin-right: 20px;
background-color: white;
border-radius: 50%;
padding: 5px;
}
.school-info {
text-align: left;
}
.school-name {
font-size: 24px;
font-weight: bold;
margin: 0;
}
.school-address {
font-size: 14px;
margin: 5px 0 0 0;
opacity: 0.8;
}
.card {
background-color: white;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
padding: 20px;
margin-bottom: 20px;
}
.card-title {
color: #2c3e50;
border-bottom: 2px solid #3498db;
padding-bottom: 10px;
margin-top: 0;
display: flex;
justify-content: space-between;
align-items: center;
}
.menu {
display: flex;
justify-content: center;
margin-bottom: 20px;
}
.menu-button {
background-color: #3498db;
color: white;
border: none;
border-radius: 4px;
padding: 12px 20px;
font-size: 16px;
cursor: pointer;
margin: 0 10px;
display: flex;
align-items: center;
transition: background-color 0.3s ease;
}
.menu-button:hover {
background-color: #2980b9;
}
.menu-button i {
margin-right: 8px;
}
.alert {
padding: 15px;
border-radius: 4px;
margin-bottom: 20px;
}
.alert-success {
background-color: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.alert-error {
background-color: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
}
th, td {
padding: 12px 15px;
text-align: left;
border-bottom: 1px solid #ddd;
}
th {
background-color: #f2f2f2;
font-weight: bold;
color: #2c3e50;
}
tr:hover {
background-color: #f5f5f5;
}
.action-buttons {
display: flex;
gap: 10px;
}
.btn-edit {
background-color: #3498db;
color: white;
border: none;
border-radius: 4px;
padding: 8px 12px;
cursor: pointer;
font-size: 14px;
}
.btn-delete {
background-color: #e74c3c;
color: white;
border: none;
border-radius: 4px;
padding: 8px 12px;
cursor: pointer;
font-size: 14px;
}
.btn-edit:hover {
background-color: #2980b9;
}
.btn-delete:hover {
background-color: #c0392b;
}
.footer {
text-align: center;
padding: 20px;
color: #777;
font-size: 12px;
}
.no-data {
text-align: center;
padding: 30px;
color: #777;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<img src="https://via.placeholder.com/80" alt="Logo Sekolah"
class="logo">
<div class="school-info">
<h1 class="school-name">SMK NEGERI 1 CONTOH</h1>
<p class="school-address">Jl. Pendidikan No. 123, Kota Contoh,
12345</p>
</div>
</div>

<!-- Menu Navigasi -->


<div class="menu">
<button class="menu-button" onclick="window.location.href='index.php'">
<i class="fas fa-home"></i> Beranda
</button>
<button class="menu-button"
onclick="window.location.href='index2.php'">
<i class="fas fa-table"></i> Laporan Absensi
</button>
<button class="menu-button"
onclick="window.location.href='tambah_siswa.php'">
<i class="fas fa-user-plus"></i> Tambah Siswa
</button>
</div>

<div class="card">
<h2 class="card-title">Daftar Siswa</h2>

<?php if (!empty($message)): ?>


<div class="alert alert-<?php echo $message_type; ?>">
<?php echo $message; ?>
</div>
<?php endif; ?>

<?php if ($result->num_rows > 0): ?>


<table>
<thead>
<tr>
<th>NIS</th>
<th>Nama</th>
<th>ID Kartu</th>
<th>Telepon/Chat ID</th>
<th>Aksi</th>
</tr>
</thead>
<tbody>
<?php while ($row = $result->fetch_assoc()): ?>
<tr>
<td><?php echo $row['nis']; ?></td>
<td><?php echo $row['nama']; ?></td>
<td><?php echo $row['kartu']; ?></td>
<td><?php echo $row['telp']; ?></td>
<td class="action-buttons">
<a href="edit_siswa.php?nis=<?php echo
$row['nis']; ?>" class="btn-edit">
<i class="fas fa-edit"></i> Edit
</a>
<a href="#" onclick="confirmDelete('<?php echo
$row['nis']; ?>', '<?php echo $row['nama']; ?>')" class="btn-delete">
<i class="fas fa-trash"></i> Hapus
</a>
</td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
<?php else: ?>
<div class="no-data">Belum ada data siswa</div>
<?php endif; ?>
</div>

<div class="footer">
&copy; <?php echo date('Y'); ?> Sistem Absensi Sekolah - Dibuat dengan
❤️
</div>
</div>

<script>
function confirmDelete(nis, nama) {
if (confirm(`Apakah Anda yakin ingin menghapus data siswa ${nama} ($
{nis})?`)) {
window.location.href = `hapus_siswa.php?nis=${nis}`;
}

You might also like