<?php require_once('../Connections/conn_apb22.php'); ?>
<?php
mysql_select_db($database_conn_apb22, $conn_apb22);
$query_rs_evenement = "SELECT * FROM table_agenda WHERE saison_agenda = '2004/2005' ORDER BY ref_agenda DESC";
$rs_evenement = mysql_query($query_rs_evenement, $conn_apb22) or die(mysql_error());
$row_rs_evenement = mysql_fetch_assoc($rs_evenement);
$totalRows_rs_evenement = mysql_num_rows($rs_evenement);
?>
<html>
<head><title>Inscription</title>
<script language="JavaScript" type="text/JavaScript">
<SCRIPT LANGUAGE="JavaScript">
function ModifierListe(ref_agenda) {
lg = document.inscription.Date_Evenement.length;
// On vide la liste
for (i = lg - 1; i >= 0; i--) {
document.inscription.Date_Evenement.options[i] = null;
}
ref_agenda = document.inscription.Evenement_choisi.selectedIndex;
<?php
// Génération des Items par Rubriques
$sql = "SELECT ref_agenda FROM table_agenda ORDER BY ref_agenda DESC";
$resultat = mysql_db_query($Base, $sql);
$max_lignes = 0;
$option_max = '';
while ($enr = mysql_fetch_array($resultat)) {
$sql = "SELECT ref_agenda, date_agenda ";
$sql .= "FROM table_agenda ";
$sql .= "WHERE ref_agenda='".$enr[0]."'";
$sql .= "ORDER BY ref_agenda desc";
$resultat2 = mysql_db_query($Base, $sql);
echo " if (document.inscription.Evenement_choisi.options[ref_agenda].value == ".$enr[0]." ) {\n";
echo " document.inscription.Date_Evenement.length = ".(mysql_num_rows($resultat2)).";\n";
$cpt = 0;
while ($enr2 = mysql_fetch_array($resultat2)) {
echo " document.inscription.Date_Evenement.options[".$cpt."].value = ".$enr2[0].";\n";
echo " document.inscription.Date_Evenement.options[".$cpt."].text = \"".$enr2[1]."\";\n";
echo " if (code_item == ".$enr2[0]." ) document.inscription.Date_Evenement.options[".$cpt."].selected = true;\n";
$cpt++;
if ($cpt > $max_lignes) $max_lignes = $cpt;
if (strlen($enr2[1]) > strlen($option_max)) $option_max = $enr2[1];
}
echo " }\n";
}
?>
}
</SCRIPT>
</head>
<body>
<form .../... choisissez un évènement dans la liste
<?php
// ---------------------------------------------------------------------
// Liste Objets_agenda (Rubriques)
// --------------------------------------------------------------
$sql = "SELECT ref_agenda, objet_agenda, date_agenda FROM table_agenda ORDER BY ref_agenda DESC";
$resultat = mysql_db_query($Base, $sql);
echo " <SELECT NAME='Evenement_choisi' onChange='ModifierListe(-1)'>\n";
while ($enr = mysql_fetch_array($resultat)) {
echo "<OPTION VALUE='".$enr[0]."'";
if ($Evenement_choisi == $enr[0]) echo " SELECTED";
echo ">".htmlspecialchars($enr[1])."</OPTION>\n";
}
echo "</SELECT> \n";
// ----------------------------------------------------------------
// Liste date_agenda (Items)
// ----------------------------------------------------------------
echo " <SELECT NAME='Date_Evenement'>\n";
for ($cpt = 0; $cpt < $max_lignes; $cpt++)
echo "<OPTION>".ereg_replace(".", "--", $option_max)."</OPTION>\n";
echo "</SELECT> \n";
if (!isset($Date_Evenement)) $Date_Evenement = -1;
echo "<SCRIPT LANGUAGE='JavaScript'>\n;ModifierListe(".$Date_Evenement." );\n</SCRIPT>\n";
// ---------------------------------------------------------------------
?>
<?php
// ---------------------------------------------------------------------
// Résultats des sélections
// -------------------------------------------------------------------
if (isset($Evenement_choisi) && $Evenement_choisi != "" ) {
$sql = "SELECT objet_agenda FROM table_agenda WHERE objet_agenda='".$Evenement_choisi."'";
$resultat = @mysql_db_query($Base, $sql);
$enr = @mysql_fetch_array($resultat);
echo "objet_agenda = $Evenement_choisi [$enr[0]]<BR>\n";
}
if (isset($Date_Evenement) && $Date_Evenement != "" && $Date_Evenement != -1) {
$sql = "SELECT date_agenda FROM table_agenda WHERE date_agenda='".$Date_Evenement."'";
$resultat = @mysql_db_query($Base, $sql);
$enr = @mysql_fetch_array($resultat);
echo "date_agenda = $Date_Evenement [$enr[0]]<BR>\n";
}
?>
.../... </form>
</body>
</html>
<?php
mysql_free_result($rs_evenement);
?>