Divers petits problèmes avec mon script
Bonjour,
Ce script me permet d'afficher les personnes associées à des comités. L'usager sélectionne la liste désirée et l'année.
1) mes deux sélect (liste et an n'affiche pas le choix de l'usager
2) si la requête est vide, le message en fin de code s'affiche avec mes deux sélect
3) Est-ce possible d'optimiser lf if pour l'affichage de la date ?
Merci!
Code:
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
| <div class="framebloc">
<?php
echo '<FORM action="ca2.php?" METHOD="GET">';
echo '<table align="center" border=3">';
echo '<tr><th>Liste désirée</th><th>Année</th><th>Action</th></tr>';
echo '<tr><td>';
require("config.inc.php");
$r_liste = "SELECT code,description FROM TB_statut where web_site='O' order by description";
$d_liste = mysql_query($r_liste);
echo '<select name="liste">';
while($ch_liste=mysql_fetch_array($d_liste)) {
echo '<option value="'.$ch_liste["code"].'" '.selected.'>'.$ch_liste["description"].'</option>\n';
}
echo '</select>';
echo '</td><td>';
$r_an = "SELECT distinct an FROM ATS_statut where type='CA' order by an desc";
$d_an = mysql_query($r_an);
echo '<p align="center"><select name="an">';
while($val=mysql_fetch_array($d_an)) {
echo "<option>".$val["an"]."</option>\n";
if($an == $val["an"]) {echo ' selected="selected"';}
}
echo '</select>';
echo '</td><td>';
echo '<INPUT TYPE="submit" VALUE="Afficher"></p>';
echo '</FORM>';
echo '</td></tr>';
if (mysql_num_rows($d_an)>0) {
$r_ca = mysql_query("SELECT * FROM `ATS_statut`
LEFT JOIN ATS_membre ON ATS_statut.passeport = ATS_membre.passeport
where ATS_statut.aff_web='O' and ATS_statut.type='$liste' and ATS_statut.an='$an' order by ATS_statut.tri_ordre,ATS_membre.nom,ATS_membre.prenom");
if (mysql_num_rows($r_ca)>0) {
echo '<table align="center" border="1" cellpadding="3">';
echo '<tr>';
echo '<th width="175">Identification</th>';
echo '<th>CE</th>';
echo '<th>Poste occupé</th>';
echo '<th>Photo</th>';
echo '<th>Début</th>';
echo '<th>Fin</th>';
echo '<th>Note</th>';
echo '</tr>';
while ($var = mysql_fetch_array($r_ca) )
{
echo '<tr>';
echo '<td><strong>'.htmlspecialchars($var['nom']).' '.htmlspecialchars($var['prenom']).'</strong></td>';
echo '<td align="center">'.htmlspecialchars($var['ce']).'</td>';
$atscourriel=htmlspecialchars($var['ats_courriel']);
if (empty($atscourriel)) {
echo '<td>'.htmlspecialchars($var['poste_occupe']).'</td>';
}
else {
echo '<td><a href="mailto:'.$atscourriel.'">'.htmlspecialchars($var['poste_occupe']).'</a></td>';
}
echo '<td align="center">NA</td>';
if ($var['dt_debut']=="0000-00-00") {
echo '<td> </td>';
}
else {
echo '<td>'.htmlspecialchars($var['dt_debut']).'</td>';
}
if ($var['dt_fin']=="0000-00-00") {
echo '<td> </td>';
}
else {
echo '<td>'.htmlspecialchars($var['dt_fin']).'</td>';
}
echo '<td>'.htmlspecialchars($var['note']).'</td>';
echo '</tr>';
}
echo '</table>';
}
else {
echo '<p align="center"><h2>Aucune fiche ne correspond à cette requête</h2></p>';
}
}
else {
echo '<p align="center"><h2>Aucune fiche ne correspond à cette requête</h2></p>';
}
mysql_close(); //Deconnection...
?>
</div> <!-- Fin Frame --> |