Work continued

This commit is contained in:
2025-02-14 21:07:37 +00:00
parent 6cd92f4314
commit e9042f8c21

View File

@@ -133,15 +133,15 @@ require_db_auth();
<div class="container">
<h2>Select a Month</h2>
<select id="monthSelect">
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
@@ -172,9 +172,18 @@ require_db_auth();
function selectMonthYear() {
let month = document.getElementById("monthSelect").value;
let year = document.getElementById("yearSelect").value;
document.getElementById("output").innerText = `You selected: ${month}-${year}`;
window.location.href = `admin.php?year=${year}&month=${month}`;
}
function selectMonth() {
let month = new URLSearchParams(window.location.search).get('month') ?? new Date().getMonth() + 1;
document.getElementById("monthSelect").value = month;
}
const year = new URLSearchParams(window.location.search).get('year') ?? new Date().getFullYear();
const month = new URLSearchParams(window.location.search).get('month') ?? new Date().getMonth() + 1;
selectMonth();
populateYearDropdown();
</script>
@@ -191,7 +200,10 @@ if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM submitted WHERE status != 'DELETED' ORDER BY eta ASC;"; // Replace with your table name
$year = $_GET['year'] ?? date('Y');
$month = $_GET['month'] ?? date('n');
$sql = "SELECT * FROM submitted WHERE status != 'DELETED' and MONTH(eta) = $month and YEAR(eta) = $year ORDER BY eta ASC;"; // Replace with your table name
$result = $conn->query($sql);
// Check if there are results