prepare("SELECT * FROM cars WHERE id = ? AND user_id = ? AND deleted_at IS NULL"); $stmt->execute([$id, $userId]); $car = $stmt->fetch(); if (!$car) { header('Location: dashboard.php'); exit; } $error = ''; $success = false; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $brand = $_POST['brand'] ?? ''; $model = $_POST['model'] ?? ''; $year = $_POST['year'] ?? ''; $price = $_POST['price'] ?? ''; $city = $_POST['city'] ?? ''; $description = $_POST['description'] ?? ''; try { $stmt = $pdo->prepare("UPDATE cars SET brand = ?, model = ?, year = ?, price = ?, city = ?, description = ?, status = 'pending' WHERE id = ?"); $stmt->execute([$brand, $model, $year, $price, $city, $description, $id]); $success = true; } catch (Exception $e) { $error = "Update failed: " . $e->getMessage(); } } $cities = ['Kabul', 'Herat', 'Mazar-i-Sharif', 'Kandahar', 'Jalalabad', 'Kunduz', 'Ghazni', 'Balkh']; ?>

Edit Listing

Update your vehicle details. Note: editing will reset the status to 'pending' for re-approval.

✨ Changes Saved!

Your listing has been updated and is now pending approval.

Back to Dashboard
Cancel