function getRegionPMobile($root_id = 0, $selected = 0, $txt = "Регион") { $db = new dataBase(); echo "<div class='form-group-custom' " . ($root_id == 0 ? "id='choose-region'" : "id='city'") . ">\n\t\t\t\t<h4>{$txt} *</h4>"; echo "<select " . ($root_id != 0 ? "name='city'" : "") . " class=\"region\" data-validate=\"v_required\">\n <option value='' disabled " . ($selected == 0 ? "selected" : "") . ">Выбрать...</option>"; $db->query("SELECT * FROM region WHERE root_id = '{$root_id}'"); while ($c = mysql_fetch_array($db->data)) { echo "<option value='" . $c['href'] . "' data-id='" . $c['id'] . "' " . (($selected === $c['id'] or $selected === $c['href']) ? "selected" : "") . ">" . $c['name'] . "</option>"; } echo "</select>"; echo "</div>"; }