prepare("DELETE FROM coupons WHERE id = ?")->execute([intval($_GET['delete'])]); admin_set_flash('success', 'Coupon deleted'); header('Location: ' . ADMIN_PATH . 'pages/coupons.php'); exit; } $coupons = $db->query("SELECT * FROM coupons ORDER BY created_at DESC")->fetchAll(); ?>
| Code | Type | Value | Min Cart | Used / Limit | Valid Till | Status | Actions |
|---|---|---|---|---|---|---|---|
| = htmlspecialchars($c['code']) ?> | = ucfirst($c['type']) ?> | = $c['type'] == 'percentage' ? $c['value'] . '%' : format_currency($c['value']) ?> | = format_currency($c['min_cart_amount']) ?> | = $c['used_count'] ?> / = $c['usage_limit'] ?: '∞' ?> | = $c['end_date'] ? date('M d, Y', strtotime($c['end_date'])) : 'No expiry' ?> | = $c['status'] ? 'Active' : 'Inactive' ?> |