<?php /* $Id: cities.php 8 2011-01-11 Alex $ */ $page = "cities"; $error = ''; include "header.php"; include "include/class_city.php"; // Основная модель городов $city = new se_city(); if (isset($_POST['submit'])) { $area_id = isset($_POST['area_id']) ? $_POST['area_id'] : NULL; $region_id = isset($_POST['region_id']) ? $_POST['region_id'] : NULL; $region = isset($_POST['region']) ? trim($_POST['region']) : NULL; $city_name = isset($_POST['city']) ? trim($_POST['city']) : NULL; if ($area_id && $region) { $region_id = $city->add_region($region, $area_id); } if ($region_id && $city_name) { $city_id = $city->add_city($city_name, $region_id); } else { $error = 'Незаполнено название города'; } } // Города-миллионники $main_cities = $city->get_main_cities(); // Округа $areas = $city->get_areas(); // Регионы и города // Структура массива - $regions[area][$i][fields] $regions = array(); // Структура массива - $cities[region][$i][fields]