prepare($sql); $stmt->execute([$name, $email, $phone, $address, $plan_id]); header("Location: customers.php"); exit; } catch (PDOException $e) { $errors[] = "Database error: " . $e->getMessage(); } } } // Fetch plans for the dropdown try { $pdo = db(); $stmt = $pdo->query("SELECT id, name FROM plans"); $plans = $stmt->fetchAll(PDO::FETCH_ASSOC); } catch (PDOException $e) { $plans = []; $errors[] = "Could not fetch plans."; } ?>