0 ? urban_hikes_find($routeId) : null; $isEditMode = $editingRoute !== null; $missingRoute = $routeId > 0 && !$editingRoute; $errors = []; $formData = [ 'city' => '', 'title' => '', 'summary' => '', 'distance_km' => '', 'duration_hours' => '', 'difficulty' => 'Moderate', 'neighborhood' => '', 'start_point' => '', 'highlights' => '', 'map_url' => '', 'best_for' => '', ]; if ($editingRoute) { $formData = array_merge($formData, $editingRoute); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $postedId = isset($_POST['route_id']) ? (int)$_POST['route_id'] : 0; if ($postedId > 0) { $result = urban_hikes_update($postedId, $_POST); $routeId = $postedId; $isEditMode = true; } else { $result = urban_hikes_create($_POST); $routeId = 0; $isEditMode = false; } if (!empty($result['success'])) { urban_hikes_set_flash('success', $postedId > 0 ? 'Route updated successfully.' : 'Route saved and published to the directory.'); header('Location: route.php?id=' . (int)$result['id']); exit; } $errors = $result['errors'] ?? []; $formData = array_merge($formData, $result['input'] ?? []); $editingRoute = $routeId > 0 ? urban_hikes_find($routeId) : null; $missingRoute = $routeId > 0 && !$editingRoute; } if ($missingRoute) { http_response_code(404); } $latestRoutes = urban_hikes_latest(10); $pageTitle = ($isEditMode ? 'Edit route' : 'Add a route') . ' | ' . urban_hikes_project_name(); $pageDescription = $isEditMode ? 'Update an existing urban hiking route and republish the latest details.' : 'Add an urban hiking route with city, difficulty, distance, highlights, and map link.'; $submitLabel = $isEditMode ? 'Save changes' : 'Publish route'; urban_hikes_render_head($pageTitle, $pageDescription, 'noindex, follow'); urban_hikes_render_nav('admin'); ?>
Route missing

That route could not be opened for editing.

Try returning to the directory and opening a valid route first.

Content admin

Enter one stop or viewpoint per line.

  • Update route content without touching the database manually
  • Keep validation and safe prepared statements in one place
  • Return to the public route page after saving
  • Refresh the route everywhere it appears in the directory
  • Add a route with the key planning fields
  • Store it in MariaDB with prepared statements
  • Redirect to a detail page with a confirmation toast
  • See it in the public directory immediately
Manage routes

Recent routes

Open directory

No routes published yet.

Route City Actions
ยท km