1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
<? require "Includes/fonctions.php"; ?>
<?
//ouverture du formulaire
echo "<form action='' method='post' name='form'>";
?>
<div class="titre">Selectionnez la personne</div>
<?
//liste des personnes de l'encadrement
$reqmvt="select NOM_ENCADREMENT, PRENOM_ENCADREMENT, NUM_ENCADREMENT from ENCADREMENT order by NOM_ENCADREMENT";
$mvt=mysql_query($reqmvt)or die(mysql_error());
echo "<select name='encadrement'><option value=''>-- Selectionnez --</option>";
while ($row=mysql_fetch_array($mvt))
{
$nom=strtoupper($row["NOM_ENCADREMENT"]);
$prenom=strtolower($row["PRENOM_ENCADREMENT"]);
$prenom=ucfirst($prenom);
echo "<option value='".$row['NUM_ENCADREMENT']."' ";
if (isset ($_POST['encadrement']) && $_POST['encadrement']==$row['NUM_ENCADREMENT']) echo " selected ";
echo "'>".$nom." ".$prenom."</option>";
}
echo "</select>";
if( isset($_POST['personne']) ) echo '<input type="hidden" name="personne" value="' .$_POST['personne']. '"/>';
?>
<div class="titre">Selectionnez sa fonction</div>
<?
//liste des fonctions
$reqfonction="select LIB_FONCTION, NUM_FONCTION from FONCTION order by LIB_FONCTION";
$fonction=mysqlquery($reqfonction) or die (mysql_error());
echo "<select name='fonction'><option value=''>-- Selectionnez --</option>";
while ($row=mysql_fetch_array($fonction))
{
echo '<option value="'.$val['NUM_FONCTION'].'" ';
if (isset ($_POST['focntion']) && $_POST['fonction']==$row['NUM_FONCTION']) echo " selected ";
echo '">'.$val['LIB_FONCTION'].'</option>';
}
echo "</select>";
?>
<hr width="100%"><div class="titre">Selectionnez la discipline</div>
<?
$reqmvt="select NUM_DISCIPLINE, NOM_DISCIPLINE from DISCIPLINE order by NOM_DISCIPLINE";
$mvt=mysql_query($reqmvt);
echo "<select name='discipline' onchange='form.submit()'>";
echo "<option value=''>-- Selectionnez --</option>";
while ($row=mysql_fetch_array($mvt))
{
$txt=Tronquer_Texte($row["NOM_DISCIPLINE"], $longeur_max);
echo "<option value='".$row["NUM_DISCIPLINE"]."' ";
if(isset ($_POST['discipline']) && ($row["NUM_DISCIPLINE"]==$_POST['discipline'])) echo ' selected="selected" ';
echo ">".$txt."</option>";
}
echo "</select>";
if (isset ($_POST['discipline'])) {
$comite="select NUM_COMITE, NOM_COMITE FROM COMITE, LIGUE, FEDERATION, DISCIPLINE WHERE comite.num_ligue=ligue.num_ligue AND federation.num_federation=discipline.num_federation AND ligue.num_federation=federation.num_federation AND discipline.num_discipline=".$_POST['discipline'];
$reqcomite=mysql_query($comite)or die(mysql_error());
echo "<select name='comite' onchange='form.submit()'><option value=''>-- Selectionnez --</option>";
while ($row=mysql_fetch_array($reqcomite))
{
$txt=Tronquer_Texte($row["NOM_COMITE"], $longeur_max);
echo "<option value='".$row["NUM_COMITE"]."' ";
if(isset ($_POST['comite']) && ($row["NUM_COMITE"]==$_POST['comite'])) echo ' selected="selected" ';
echo ">".$txt."</option>";
}
echo "</select>";
if (isset ($_POST['comite'])) {
$club="select NUM_CLUB, NOM_CLUB FROM CLUB WHERE club.num_comite=".$_POST['comite'];
$reqclub=mysql_query($club)or die(mysql_error());
echo "<select name='club'><option value=''>-- Selectionnez --</option>";
while ($row=mysql_fetch_array($reqclub))
{
$txt=Tronquer_Texte($row["NOM_CLUB"], $longeur_max);
echo "<option value='".$row["NUM_COMITE"]."'>".$txt."</option>";
}
echo "</select>";
echo "<input type='submit' value='Valider'>";
}
}
//fermeture du formulaire
echo "</form>";
// Si encadrement, fonction et club existent et sont non vides
if (isset ($_POST['encadrement'] , $_POST['fonction'] , $_POST['club']) && !empty($_POST['encadrement']) && !empty($_POST['fonction']) && !empty($_POST['club']) ) {
$sql="select NUM_CLUB, NUM_ENCADREMENT, NUM_FONCTION from ENCADRER_CLUB where NUM_CLUB=".$_POST['club']." AND NUM_ENCADREMENT= ".$_POST['encadrement']." AND NUM_FONCTION= " .$_POST['fonction'];
$query=mysql_query($sql);
$nbnum=mysql_num_rows($query);
$reqclub="select NOM_CLUB from club where NUM_CLUB=".$_POST['club'];
$club=mysql_query($reqclub) or die (mysql_error());
$row=mysql_fetch_array($club);
if ($nbnum!=NULL)
{
echo "CLub <b>".$row['NOM_CLUB']."</b> déjà selectionné pour cette personne<br><br>";
}
else
{
$insert="insert into ENCADRER_CLUB values('".$_POST['encadrement']."','".$_POST['fonction']."','".$_POST['club']."')";
$query=mysql_query($insert) or die ($insert.' : '.mysql_error());
echo "Insertion Réussie pour le comite <b>".$row['NOM_CLUB']."</b><br>";
}
}
else
{
echo "<b>ERREUR REQUETE</b>";
} |
Partager