diff --git a/create_customer.php b/create_customer.php new file mode 100644 index 0000000..1e0dc81 --- /dev/null +++ b/create_customer.php @@ -0,0 +1,109 @@ +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."; +} + +?> + +