query('SELECT id, name FROM institutions ORDER BY name')->fetchAll(); $programs = $pdo->query('SELECT id, name FROM programs ORDER BY name')->fetchAll(); $courses = $pdo->query('SELECT id, name FROM courses ORDER BY name')->fetchAll(); // Handle form submissions if ($_SERVER['REQUEST_METHOD'] === 'POST') { $statement = trim($_POST['statement']); $rel_type = $_POST['rel_type']; $rel_id = $_POST['rel_id']; if (isset($_POST['add_statement'])) { if (!empty($statement) && !empty($rel_type) && !empty($rel_id)) { $stmt = $pdo->prepare('INSERT INTO mission_statements (statement, rel_type, rel_id) VALUES (?, ?, ?)'); $stmt->execute([$statement, $rel_type, $rel_id]); } } elseif (isset($_POST['update_statement'])) { if (!empty($statement) && !empty($rel_type) && !empty($rel_id) && !empty($id)) { $stmt = $pdo->prepare('UPDATE mission_statements SET statement = ?, rel_type = ?, rel_id = ? WHERE id = ?'); $stmt->execute([$statement, $rel_type, $rel_id, $id]); } header('Location: admin_mission_statements.php'); exit; } elseif (isset($_POST['delete_statement'])) { if (!empty($id)) { $stmt = $pdo->prepare('DELETE FROM mission_statements WHERE id = ?'); $stmt->execute([$id]); } header('Location: admin_mission_statements.php'); exit; } } ?>
| Statement | Linked To | Actions |
|---|---|---|
| " . htmlspecialchars($row['statement']) . " | "; echo "" . ucfirst($row['rel_type']) . ': ' . htmlspecialchars($rel_name) . " | "; echo 'Edit Delete | '; echo "