["min_range" => 1]])) { $errors[] = 'Capacity must be a positive number.'; } if (!filter_var($price_per_day, FILTER_VALIDATE_INT, ["options" => ["min_range" => 0]])) { $errors[] = 'Price must be a non-negative number.'; } if (empty($errors)) { try { $pdo = db(); $sql = "INSERT INTO vehicles (name, type, capacity, price_per_day, is_available, image_url) VALUES (?, ?, ?, ?, ?, ?)"; $stmt = $pdo->prepare($sql); // Using a placeholder image for now $placeholder_image = 'assets/images/vehicle_placeholder.png'; $stmt->execute([$name, $type, $capacity, $price_per_day, $is_available, $placeholder_image]); header("Location: admin_vehicles.php?success=1"); exit; } catch (PDOException $e) { $errors[] = "Database error: " . $e->getMessage(); } } } require_once 'includes/admin_sidebar.php'; ?>

Add New Vehicle

Fill out the form to add a new vehicle to the fleet.

Vehicle Details


Cancel