Размер файла: 2.06Kb
<?php
/**********************************************/
/* Автор скрипта: Александр Есин */
/* E-Mail: [email protected] ([email protected]) */
/* ICQ: 6464729 */
/* Site: http://ticlove.ru */
/**********************************************/
?>
<?php define ('SECURED', true); ?>
<?php require (dirname(__FILE__).'/../_inc/sql.php'); ?>
<?php require (dirname(__FILE__).'/../_inc/config.php'); ?>
<?php require (dirname(__FILE__).'/../_inc/function.php'); ?>
<?php
if (isset($_POST['act']) && $_POST['act'] == 1) {
$country_id = isset($_POST['id_country']) ? intval($_POST['id_country']) : 0;
$res = mysql_query("SELECT * FROM `q_region` WHERE `id_country` = '".$country_id."' ORDER BY `name_region` ASC;");
$select = '<select class="select" style="width:200px;" id="sel_region" name="sel_region" onchange="javascript:select_city()"'.(!isset($_SESSION['auth_id']) ? ' onfocus="sel_region_focus()" onblur="sel_region_blur()"' : '').'><option value="">-- Выберите регион --</option>';
while ($row = mysql_fetch_assoc($res)) {
$select .= '<option value="'.$row['id_region'].'">'.htmlspecialchars($row['name_region'], ENT_QUOTES).'</option>';
}
$select .= '</select>';
echo $select;
}
if (isset($_POST['act']) && $_POST['act'] == 2) {
$country_id = isset($_POST['id_country']) ? intval($_POST['id_country']) : 0;
$id_region = isset($_POST['id_region']) ? intval($_POST['id_region']) : 0;
$sql = mysql_query("SELECT * FROM `q_city` WHERE `id_country` = '".$country_id."' AND `id_region` = '".$id_region."' ORDER BY `name_city` ASC;");
$select = '<select class="select" style="width:200px;" id="sel_city" name="sel_city"'.(!isset($_SESSION['auth_id']) ? ' onfocus="sel_city_focus()" onblur="sel_city_blur()"' : '').'><option value="">-- Выберите город --</option>';
while ($assoc = mysql_fetch_assoc($sql)) {
$select .= '<option value="'.$assoc['id_city'].'">'.htmlspecialchars($assoc['name_city'], ENT_QUOTES).'</option>';
}
$select .= '</select>';
echo $select;
}
?>