90 lines
3.5 KiB
PHP
90 lines
3.5 KiB
PHP
<?php
|
|
session_start();
|
|
|
|
if (!isset($_SESSION['user_id'])) {
|
|
header('Location: index.php');
|
|
exit;
|
|
}
|
|
|
|
require_once 'db/config.php';
|
|
|
|
$id = $_GET['id'] ?? null;
|
|
if (!$id) {
|
|
header('Location: school_settings.php');
|
|
exit;
|
|
}
|
|
|
|
$grade = null;
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->prepare("SELECT id, section, grade_name, min_score, max_score FROM grading_scales WHERE id = ?");
|
|
$stmt->execute([$id]);
|
|
$grade = $stmt->fetch();
|
|
} catch (PDOException $e) {
|
|
die("Database error: " . $e->getMessage());
|
|
}
|
|
|
|
if (!$grade) {
|
|
die("Grade not found.");
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Edit Grade - Admin Dashboard</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&family=Open+Sans&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css">
|
|
</head>
|
|
<body class="admin-body">
|
|
<div class="admin-container">
|
|
<aside class="sidebar">
|
|
<div class="sidebar-header">
|
|
<h2>School Admin</h2>
|
|
</div>
|
|
<nav class="sidebar-nav">
|
|
<a href="admin.php">Dashboard</a>
|
|
<a href="users.php">User Management</a>
|
|
<a href="school_settings.php" class="active">School Settings</a>
|
|
<a href="#">Subjects & Classes</a>
|
|
<a href="#">Student Promotions</a>
|
|
<a href="#">Reports</a>
|
|
<a href="logout.php" class="logout">Logout</a>
|
|
</nav>
|
|
</aside>
|
|
<main class="main-content">
|
|
<header class="main-header">
|
|
<h1>Edit Grade</h1>
|
|
</header>
|
|
<div class="content-grid">
|
|
<div class="card full-width-card">
|
|
<div class="card-body">
|
|
<form action="update_grade.php" method="POST">
|
|
<input type="hidden" name="id" value="<?= htmlspecialchars($grade['id']) ?>">
|
|
<div class="form-group">
|
|
<label for="section">Section</label>
|
|
<input type="text" id="section" name="section" class="form-control" value="<?= htmlspecialchars($grade['section']) ?>" readonly>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="grade_name">Grade Name</label>
|
|
<input type="text" id="grade_name" name="grade_name" class="form-control" value="<?= htmlspecialchars($grade['grade_name']) ?>" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="min_score">Min Score</label>
|
|
<input type="number" id="min_score" name="min_score" class="form-control" value="<?= htmlspecialchars($grade['min_score']) ?>" required>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="max_score">Max Score</label>
|
|
<input type="number" id="max_score" name="max_score" class="form-control" value="<?= htmlspecialchars($grade['max_score']) ?>" required>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary">Update Grade</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</body>
|
|
</html>
|