/var/www/vhosts/m-auto.co/httpdocs/admin
Edit: /var/www/vhosts/m-auto.co/httpdocs/admin/offer_form.php (4573B)
'',
'title' => '',
'description' => '',
'car_id' => null,
'discount_price' => '',
'image' => ''
];
$page_title = "إضافة عرض جديد";
// Fetch cars for the dropdown
$cars_result = $conn->query("SELECT id, name FROM cars ORDER BY name");
// Check if this is an edit request
if (isset($_GET['id'])) {
$offer_id = $_GET['id'];
$stmt = $conn->prepare("SELECT * FROM offers WHERE id = ?");
$stmt->bind_param("i", $offer_id);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows === 1) {
$offer = $result->fetch_assoc();
$page_title = "تعديل العرض";
} else {
header("Location: offers.php?error=Offer not found");
exit();
}
$stmt->close();
}
?>
= $page_title ?>