<?
print(" <select tabindex=-1 name=\"id_groupe\" size=1 width=200 OnChange=\"choice.value = -2; submit();\">\n");
if (count($id_promotion) > 0)
{
$from = "groupe,associer as t0";
$where = "t0.id_promotion = ".$id_promotion[0]." ";
for ($i=1;$i<count($id_promotion);$i++)
{
$where = $where."AND t$i.id_promotion = ".$id_promotion[$i]." ";
$from = $from.",associer as t$i";
}
for ($i=1;$i<count($id_promotion);$i++)
$where = $where."AND t".($i-1).".id_groupe = t".$i.".id_groupe ";
$request = "SELECT groupe.id_groupe,groupe.nom,groupe.id_type_groupe FROM ".$from." WHERE ".$where." AND groupe.id_groupe = t0.id_groupe ORDER BY nom";
$result = mysql_query($request);
$index_max = mysql_num_rows($result);
$found = false;
for ($i=0;$i<$index_max;$i++)
{
$a_record = mysql_fetch_array($result);
if ($id_groupe == $a_record["id_groupe"])
{
print(" <option selected value=".$a_record["id_groupe"]." >");
$found = true;
}
else
print(" <option value=".$a_record["id_groupe"].">");
print($a_record["nom"]);
print("</option>\n");
}
if (!$found) print("<option selected value=-1 >\n");
else print("<option value=-1>\n");
print("</option>");
}
print(" </select>\n");
?>