1) { LOG_INFO($db_link,'Удаляем расположение с id: '.$val); delete_record($db_link, "building", "id=" . $val); } } header("Location: " . $_SERVER["REQUEST_URI"]); } if (isset($_POST['save'])) { $len = is_array($_POST['id']) ? count($_POST['id']) : 0; for ($i = 0; $i < $len; $i ++) { $save_id = intval($_POST['save'][$i]); if ($save_id == 0) { continue; } $len_all = is_array($_POST['id']) ? count($_POST['id']) : 0; for ($j = 0; $j < $len_all; $j ++) { if (intval($_POST['id'][$j]) != $save_id) { continue; } $value = $_POST['f_building_name'][$j]; $value_comment = $_POST['f_building_comment'][$j]; if (isset($value)) { $new['name'] = $value; $new['comment'] = $value_comment; LOG_INFO($db_link,"Изменяем расположение id='{$save_id}': name=".$value." comment=".$value_comment); update_record($db_link, "building", "id='{$save_id}'", $new); } } } header("Location: " . $_SERVER["REQUEST_URI"]); } if (isset($_POST["create"])) { $building_name = $_POST["new_building"]; if (isset($building_name)) { $new['name'] = $building_name; LOG_INFO($db_link,'Добавляем расположение $building_name'); insert_record($db_link, "building", $new); } header("Location: " . $_SERVER["REQUEST_URI"]); } unset($_POST); require_once ($_SERVER['DOCUMENT_ROOT']."/inc/header.php"); print_device_submenu($page_url); ?>