prepare("UPDATE hospitals SET status = ? WHERE id = ?"); $stmt->execute([$new_status, $hospital_id]); } header("Location: admin_dashboard.php"); exit; } // Handle donor status updates if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['donor_id'])) { $donor_id = $_POST['donor_id']; $new_status = $_POST['status']; // 'approved' or 'rejected' if (in_array($new_status, ['approved', 'rejected'])) { $stmt = $pdo->prepare("UPDATE donors SET status = ? WHERE id = ?"); $stmt->execute([$new_status, $donor_id]); } header("Location: admin_dashboard.php?tab=donors"); exit; } // Fetch pending hospitals $stmt_hospitals = $pdo->prepare("SELECT * FROM hospitals WHERE status = 'pending_verification'"); $stmt_hospitals->execute(); $pending_hospitals = $stmt_hospitals->fetchAll(PDO::FETCH_ASSOC); // Fetch all donors $stmt_donors = $pdo->prepare("SELECT * FROM donors ORDER BY registration_date DESC"); $stmt_donors->execute(); $all_donors = $stmt_donors->fetchAll(PDO::FETCH_ASSOC); // Fetch all recipients $stmt_recipients = $pdo->prepare("SELECT r.*, h.hospital_name FROM recipients r JOIN hospitals h ON r.hospital_id = h.id ORDER BY r.registration_date DESC"); $stmt_recipients->execute(); $all_recipients = $stmt_recipients->fetchAll(PDO::FETCH_ASSOC); ?>
No pending hospital registrations.
| ID | Hospital Name | Phone | Registered On | Action | |
|---|---|---|---|---|---|
| ID | Name | Blood Type | Organs | Status | Action | |
|---|---|---|---|---|---|---|
| ID | Name | Blood Type | Organ Needed | Registered By | Date |
|---|---|---|---|---|---|