<?php
header('Content-Type: text/html; charset=utf-8');
require 'database.inc.php';
if (Test_User($lg_user, $lg_password) == TRUE) {
  $requette = "SELECT * FROM npa WHERE NPA='$NPA'";
  $resultat = NPA::getByNPA($NPA);
  $first = 1;
  foreach ($resultat as $ligne) {
    if ($first == 1) {
      $first = 0;
      echo "if(confirm('" . htmlspecialchars($ligne['Localite']) . "'))\n";
    } else {
      echo "else if(confirm('" . htmlspecialchars($ligne['Localite']) . "'))\n";
    }
    echo "{\n";
    echo "document.getElementById('Localite').value='" . htmlspecialchars($ligne['Localite']) . "';\n";
    echo "}\n";
  }
}
