prepare("UPDATE residents SET status = ? WHERE id = ?"); $stmt->execute([$status, $resident_id]); // Redirect back to the resident's view page header("Location: resident_view.php?id={$resident_id}&success=status_updated"); exit; } catch (PDOException $e) { // Log the error in a real app header("Location: resident_view.php?id={$resident_id}&error=db_error"); exit; }