$psCountry = null; $pnPostalCode = null; $pnPostalCodeUkDebut = null; $pnPostalCodeUkFin = null; $out = '<label for="city" class="control-label">City</label>'; if (isset($_GET['country']) && $_GET['country'] != '') { if (isset($_GET['postalCode']) && $_GET['postalCode'] != '') { require_once '/var/www/appli/class/class.exa.php'; $obj = new exaprint(); $psCountry = "AND TP.LibellePays = '" . str_replace("'", "''", $_GET['country']) . "'"; $pnPostalCode = "AND TV.CodePostal = '" . str_replace("'", "''", $_GET['postalCode']) . "'"; // if(isset($_GET['postalCodeUKDebut']) && $_GET['postalCodeUKDebut'] != '') $pnPostalCodeUkDebut = "AND TVAA.debutPlageCodePostal = '".str_replace("'","''",$_GET['postalCodeUKDebut'])."'"; // if(isset($_GET['postalCodeUKFin']) && $_GET['postalCodeUKFin'] != '') $pnPostalCodeUkFin = "AND TVAA.finPlageCodePostal = '".str_replace("'","''",$_GET['postalCodeUKFin'])."'"; $obj->getConDbo(); $q = "SELECT\n TV.LibelleVille\nFROM\n TBL_PAYS AS TP\n LEFT OUTER JOIN TBL_VILLE AS TV ON TP.IDPays = TV.IDPaysVille\n --LEFT OUTER JOIN TBL_VILLE_ANNEXE_ANGLETERRE AS TVAA ON TV.IDVille = TVAA.idVille\nWHERE\n TP.GereVille = 1\n {$psCountry}\n {$pnPostalCode}\n /*{$pnPostalCodeUkDebut}\n {$pnPostalCodeUkFin}*/\nORDER BY\n TP.LibellePays ASC\n , TV.LibelleVille ASC\n , TV.CodePostal ASC"; $row = $obj->execMsSql($q); if (is_array($row)) { $out .= '<select id="city" name="city" class="form-control">'; if (count($row) > '1') { $out .= '<option></option>'; } foreach ($row as $key => $value) { $out .= '<option value="' . $value->LibelleVille . '">' . $value->LibelleVille . '</option>'; } $out .= '<select>'; } else { $out .= '<input type="text" class="form-control" id="city" name="city" onkeyup="getValidForm();" placeholder="write here">'; } } else { $out .= '<input type="text" class="form-control" id="city" name="city" onkeyup="getValidForm();" placeholder="write here">'; }