<?php
  switch($Etape)
  {
    case 0:
      echo "  <form>\n";
      echo "   <input type='hidden' name='Type' value=$Type>\n";
      echo "   <input type='hidden' name='Sous_Type' value=$Sous_Type>\n";
      echo "   <input type='hidden' name='Etape' value='1'>\n";
      echo "<TABLE border=1>\n";
      echo "   <TR><TH>Nom</TH><TD><input type='texte' name='Nom'></TD></TR>\n";
      echo "   <TR><TH>Password</TH><TD><input type='password' name='Password'></TD></TR>\n";
      echo "   <TR><TH>Groupe</TH><TD><SELECT name='nogroupeusers'>\n";
      if ($resultat2 = GroupeUsers::getAll())
      {
        foreach($resultat2 as $ligne2)
        {
          echo "<OPTION value='".$ligne2['NoGroupeUsers']."'>".$ligne2['Description']."</OPTION>\n";
        }
      }
      echo "   </SELECT></TD></TR>\n";
      echo "</TABLE>\n";
      echo "   <button type='submit'>Créer</button>\n";
      echo "  </form>\n";
    break;
    case 1:
      $requette = "INSERT INTO users (Nom, Password, NoGroupeUsers) VALUES ('$Nom', '".md5($Password)."', '$nogroupeusers')";
      if ($resultat = Connection::executeRawQuery($requette))
      {
      }
      else
      {
        echo "<big>utilisateur $Nom existe déjà !</big>";
      }
    break;
  }
  
?>
