<div class="container-fluid p-0">
  <?php if ($cp==""): ?>
    <div class="row">
      <div class="col p-0">
        <p class="m-3">Veuillez saisir un code postal</p>
      </div>
    </div>
  <?php elseif (count($villes)==0 && strlen($cp)=="5"): ?>
    <div class="row">
      <div class="col">
        <p>Aucune ville pour ce code postal</p>
        <div class="">
          <label for="new_ville" class="form-label">Nouvelle ville</label>
          <input type="text" name="new_ville" id="new_ville" class="form-control form-control-sm" value="">
          <button type="button" class="btn btn-sm btn-primary icon-plus" onclick="javascript:newVille();"> ajouter</button>
        </div>
      </div>
    </div>
  <?php else: ?>
    <div class="row">
      <div class="col">
        <label for="id_ville" class="form-label">Ville</label>
        <select class="form-select" aria-label="selection de la ville du patient" name="id_ville" id="id_ville">
          <option value="0"> - - </option>
          <?php foreach ($villes as $key => $vi): ?>
            <option value="<?=$vi['id'];?>"<?=((isset($ville) && $vi['id']==$ville['id'])?" selected":"");?>><?=$vi['libel'];?></option>
          <?php endforeach; ?>
        </select>
      </div>
    </div>
  <?php endif; ?>
</div>
