Теперь необходимо добавить автозаполнение к полю профессии с id="proff". Никак не получается сделать обработчик на PHP. Помогите пожалуйста!
Код обработчика поля город:
<?php
define('PATH', dirname(__FILE__));
define("VALID_CMS", 1);
include(PATH.'/core/cms.php');
$inCore = cmsCore::getInstance();
$inDB = cmsDatabase::getInstance();
$city = $inCore->request('query', 'str');
if(!$city)exit;
//Идентификатор главной страны
$id_main_country = 1;
$sql = "SELECT s.id_city, s.id_region, s.id_country, s.city_name_ru, r.region_name_ru, c.country_name_ru, COUNT( p.id ) AS popule
FROM cms_geo_cities s
LEFT JOIN cms_user_profiles p ON s.city_name_ru = p.city
LEFT JOIN cms_geo_countries c ON s.id_country = c.id_country
LEFT JOIN cms_geo_regions r ON s.id_region = r.id_region
WHERE city_name_ru LIKE '{$city}%'
GROUP BY s.city_name_ru
ORDER BY popule DESC , s.city_name_ru ASC";
$res = $inDB->query($sql);
if ($inDB->num_rows($res)) {
while($ress = $inDB->fetch_assoc($res)){
$suggestions[] = ($ress['popule'] > 10 ? '<b>' : '').$ress['city_name_ru'].($ress['popule'] > 10 ? '</b>' : '').' <i> \ '.$ress['region_name_ru'].($ress['id_country']==$id_main_country ? '' : '<span> \ '.$ress['country_name_ru'].'</span>').'</i>';
$data[] = array('city' => $ress['city_name_ru'], 'id_city' => $ress['id_city'], 'id_region' => $ress['id_region'], 'id_country' => $ress['id_country']);
}
}
cmsCore::jsonOutput(array('query' => $city, 'suggestions' => $suggestions, 'data' => $data));
Нужно переделать для поля профессия.