prepare("INSERT INTO elections (id, title, description, status, start_date_and_time, end_date_and_time, created_by) VALUES (?, ?, ?, 'Preparing', ?, ?, ?)"); $stmt->execute([$id, $title, $description, $start_date, $end_date, $user['id']]); audit_log('Created election', 'elections', $id); header("Location: ../view_election.php?id=$id&success=1"); exit; } catch (Exception $e) { die("Error: " . $e->getMessage()); } } else { header("Location: ../index.php"); exit; }