Viewing file: alladmission.php (6.41 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<!DOCTYPE html> <html lang="en">
<?php include 'head.php';?> <style> table { border-collapse: collapse; width: 100%; margin-top: 20px; }
table, th, td { border: 1px solid #ddd; }
th, td { padding: 8px; text-align: left; }
th { background-color: #f2f2f2; font-weight: bold; } .custom-image { width: 100px; height: 100px; } </style> <body>
<!-- ======= Header ======= --> <?php include 'menubar.php';?>
<?php include 'sidebar.php';?>
<main id="main" class="main">
<?php include 'connect.php'; $sql = " SELECT * FROM admission ORDER BY CAST(SUBSTRING_INDEX(enrollment, '/', -1) AS UNSIGNED) DESC "; $result = $conn->query($sql); ?>
<!DOCTYPE html> <html> <head> <title>View Student Registration</title> <style> body { font-family: Arial, sans-serif; padding: 20px; background: #f9f9f9; }
h1 { color: #004080; text-align: center; margin-bottom: 20px; }
.search-box { text-align: center; margin-bottom: 20px; }
.search-box input { padding: 10px; width: 60%; font-size: 16px; border: 1px solid #ccc; border-radius: 4px; }
.action-buttons { text-align: center; margin-bottom: 20px; }
.action-buttons button { padding: 10px 20px; margin: 0 5px; background: #004080; border: none; color: white; border-radius: 4px; cursor: pointer; }
.action-buttons button:hover { background: #0066cc; }
table { width: 100%; border-collapse: collapse; background: white; box-shadow: 0 0 10px rgba(0,0,0,0.05); }
th, td { padding: 10px; text-align: center; border: 1px solid #ddd; }
th { background-color: #004080; color: white; }
tr:hover { background-color: #f1f9ff; }
.custom-image { width: 60px; height: 60px; object-fit: cover; border-radius: 5px; border: 1px solid #aaa; }
.pagination { margin-top: 20px; text-align: center; }
.pagination button { padding: 8px 16px; margin: 0 5px; border: none; background-color: #004080; color: white; cursor: pointer; border-radius: 4px; }
.pagination button:disabled { background-color: #aaa; cursor: not-allowed; } </style> </head> <body>
<h1>View Student Registration</h1>
<div class="search-box"> <input type="text" id="searchInput" onkeyup="filterTable()" placeholder="Search students by any field..."> </div>
<div class="action-buttons"> <button onclick="exportToExcel()">Export to Excel</button> </div>
<table id="studentTable"> <thead> <tr> <th>Photo</th> <th>Name</th> <th>Enrollment</th> <th>Father</th> <th>Mother</th> <th>DOB</th> <th>Address</th> <th>Mobile</th> <th>Aadhar</th> <th>Reg Date</th> </tr> </thead> <tbody> <?php if ($result->num_rows > 0) { while ($row = $result->fetch_assoc()) { $photo = "https://itce.co.in/data/files/" . $row['photo'];
echo "<tr>"; echo "<td><img src='{$photo}' alt='{$row["name"]}' class='custom-image'></td>"; echo "<td>{$row["name"]}</td>"; echo "<td>{$row["enrollment"]}</td>"; echo "<td>{$row["fatherName"]}</td>"; echo "<td>{$row["motherName"]}</td>"; echo "<td>{$row["dob"]}</td>"; echo "<td>{$row["address"]}</td>"; echo "<td>{$row["mobile"]}</td>"; echo "<td>{$row["aadhar"]}</td>"; echo "<td>{$row["reg_date"]}</td>"; echo "</tr>"; } } else { echo "<tr><td colspan='10'>No student data available</td></tr>"; } ?> </tbody> </table>
<div class="pagination"> <button onclick="prevPage()" id="btnPrev">Previous</button> <span id="pageInfo"></span> <button onclick="nextPage()" id="btnNext">Next</button> </div>
<script> const rowsPerPage = 1000; let currentPage = 1; let filteredRows = [];
function getAllRows() { return Array.from(document.querySelectorAll("#studentTable tbody tr")); }
function filterTable() { const filter = document.getElementById("searchInput").value.toLowerCase(); const allRows = getAllRows();
filteredRows = allRows.filter(row => row.innerText.toLowerCase().includes(filter)); allRows.forEach(row => row.style.display = "none"); displayPage(1); }
function displayPage(page) { const totalPages = Math.ceil(filteredRows.length / rowsPerPage); const start = (page - 1) * rowsPerPage; const end = start + rowsPerPage;
getAllRows().forEach(row => row.style.display = "none"); filteredRows.slice(start, end).forEach(row => row.style.display = "");
document.getElementById("pageInfo").innerText = `Page ${page} of ${totalPages || 1}`; document.getElementById("btnPrev").disabled = page <= 1; document.getElementById("btnNext").disabled = page >= totalPages;
currentPage = page; }
function nextPage() { if (currentPage < Math.ceil(filteredRows.length / rowsPerPage)) { displayPage(currentPage + 1); } }
function prevPage() { if (currentPage > 1) { displayPage(currentPage - 1); } }
window.onload = () => { filteredRows = getAllRows(); displayPage(1); };
// ✅ Export to Excel function function exportToExcel() { let table = document.getElementById("studentTable"); let html = table.outerHTML.replace(/ /g, '%20');
let a = document.createElement('a'); a.href = 'data:application/vnd.ms-excel,' + html; a.download = 'student_data.xls'; a.click(); } </script>
</body> </html>
</main><!-- End #main -->
<?php include 'footer.php';?>
</body>
</html>
|