<? //Query Form
$arSelect = Array("ID", "NAME");
$arFilter = Array("IBLOCK_CODE"=>"countries", "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y");
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement())
{
$arFields = $ob->GetFields();
$Filter["countries"][] = array("ID" => $arFields["ID"], "NAME" => $arFields["NAME"]);
}
if (htmlspecialchars($_GET["p_hotel_country"])) {
$arSelect = Array("ID", "NAME");
$arFilter = Array("IBLOCK_CODE"=>"cities", "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y",
X PROPERTY_COUNTRY" => htmlspecialchars($_GET["p_hotel_country"]));
$res = CIBlockElement::GetList(Array(), $arFilter, false, false, $arSelect);
while($ob = $res->GetNextElement())
{
$arFields = $ob->GetFields();
$Filter["cities"][] = array("ID" => $arFields["ID"], "NAME" => $arFields["NAME"]);
}}
?>
<div class="hotels_query_form">
<form method="get" action="" id="hotels_query_form" name="hotels_query_form" rel class="jNice">
<fieldset class="country">
<span class="l">Страна:</span>
<select size="1" name="p_hotel_country" onchange="jQuery('#p_hotel_city').val('');
jQuery('#hotels_query_form').submit();">
<option value="0" <? if (!htmlspecialchars($_GET["p_hotel_country"]))
{echo 'selected="selected"';} ?>>- все -</option>
<?
foreach ($Filter["countries"] as $Element)
{
?><option <? if (htmlspecialchars($_GET["p_hotel_country"]) == $Element["ID"])
{echo ' selected="selected" ';} ?> value="<?=$Element["ID"]?>"><?=$Element["NAME"]?></option><?
}
?>
</select>
</fieldset>
<fieldset class="sity">
<span class="l">Город:</span>
<select size="1" name="p_hotel_city" id="p_hotel_city" onchange="jQuery('#hotels_query_form').submit();">
<option value="0" <? if (!htmlspecialchars($_GET["p_hotel_city"]))
{echo 'selected="selected"';} ?>>- все -</option>
<?
foreach ($Filter["cities"] as $Element)
{
?><option <? if (htmlspecialchars($_GET["p_hotel_city"]) == $Element["ID"])
{echo ' selected="selected" ';} ?> value="<?=$Element["ID"]?>"><?=$Element["NAME"]?></option><?
}
?>
</select>
</fieldset>
</form>
</div> |