prepare("DELETE FROM election_assignments WHERE user_id = ? AND election_id = ? AND role_in_election = 'Voter'"); $stmt->execute([$userId, $electionId]); // Optional: Log the action $currentUser = get_user(); audit_log('voter_removed', 'users', $userId, null, null, "Removed voter ID $userId from election $electionId"); header("Location: ../voter_management.php?success=voter_deleted"); exit; } catch (PDOException $e) { die("Error deleting voter: " . $e->getMessage()); } } else { header("Location: ../voter_management.php"); exit; }