/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ $conf = parse_ini_file('/var/www/html/v1/config/app.ini'); require_once $conf['basedir'] . '/class/class.cars.php'; $cars = new cars(); $action = isset($_GET['action']) ? $_GET['action'] : NULL; $type = isset($_GET['type']) ? $_GET['type'] : NULL; $make = isset($_POST['make']) ? $_POST['make'] : NULL; $model = isset($_POST['model']) ? $_POST['model'] : NULL; if ($action == 'modelsByType') { if ($type === 'all') { $mbt = $cars->getAllMakes(); foreach ($mbt as $k => $v) { echo "<option value=\"{$v["makeID"]}\">{$v["makeName"]}</option>\n"; } } else { $mbt = $cars->getModelByType($type); foreach ($mbt as $k => $v) { echo "<option value=\"{$v["makeID"]}\">{$v["makeName"]}</option>\n"; } } } if (!is_null($make) && is_null($model)) { $query = "SELECT * FROM model WHERE make ='" . $make . "'"; $type = isset($_POST['type']) ? $_POST['type'] : NULL; if (isset($type) and $type !== 'all') { $query .= " AND type IN (SELECT id FROM category WHERE name = '" . $type . "')";