Filtre PHP

Je souhaiterai donner la possibilité sur cette page d'avoir des filtre (genre excel) sur les classes des élèves
avoir cette possibilité là d'afficher toutes les classes des élèves ou une seule en particulier
voici le code. je suis apprenti en php

<?php
session_start();
if (!(isset($_SESSION['NIV']))){
    header("location:index.html");
}

require_once("connection.php");
$order = isset($_GET['order'])?$_GET['order']:'ASC';
$req = "select * from ELEVES
           ORDER BY CLASSE $order ";
$rs = mysql_query($req) or die(mysql_error());

$thOrder = $order == 'ASC'? 'DESC' : 'ASC';

?>


<html>
<head>
    <meta charset="utf-8">
<title>Affichage des élèves</title>
<link href="stle.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
function imprimer(url){
  options = "Width=700,Height=700" ;
  window.open( url, "Impression", options ) ;
 }
</script>
</head>
<body>
<table width="500" border="0">
    <tr>
        <td><a href="saisieEleve.html"><br>Inscrire un élève</a></td>
        <td><a href="ChercherEleves.php"><br>Rechercher un élève</a></td>
        <td><a href="index.html"><br>Accueil</a></td>
    </tr>
</table>
<br>
<table border="1" width="50%">
    <tr>
        <th></th>
        <th>PHOTO</th>
        <th><a href="?order=<?php echo $thOrder; ?>" >CLASSE </a></th>
        <th>SECTION</th>
        <th>GROUPEMENT</th>
        <th>INSCRIPTION</th>
        <th>NOM</th>
        <th>PRENOM</th>
        <th>POSTNOM</th>
        <th>NAISSANCE</th>
        <th>SEXE</th>
        <th>NATIONALITE</th>
        <th>ADRESSE</th>
        <th>PERE</th>
        <th>TEL PERE</th>
        <th>ADRESSE DOMICILE</th>
    </tr>
    <?php while ($ET = mysql_fetch_assoc($rs)) { ?>
        <tr>
            <td><a href="detailEleve.php?code=<?php echo $ET['CODE'] ;?>" class="bouton" 
onclick="imprimer('detailEleve.php?code=<?php echo $ET['CODE'];?>') ;return false;">Imprimer</a></td>
            <td><img src="images/<?php echo($ET['PHOTO']) ?>" width="90" height="113"</td>
            <td><?php echo($ET['CLASSE']) ?></td>
            <td><?php echo($ET['SECTION']) ?></td>
            <td><?php echo($ET['GROUPEMENT']) ?></td>
            <td><?php echo($ET['INSCRIPTION']) ?></td>
            <td><?php echo($ET['NOM']) ?></td>
            <td><?php echo($ET['PRENOM']) ?></td>
            <td><?php echo($ET['POSTNOM']) ?></td>
            <td><?php echo($ET['NAISSANCE']) ?></td>
            <td><?php echo($ET['SEXE']) ?></td>
            <td><?php echo($ET['NATIONALITE']) ?></td>
            <td><?php echo($ET['ADRESSE']) ?></td>
            <td><?php echo($ET['PERE']) ?></td>
            <td><?php echo($ET['TELPERE']) ?></td>
            <td><?php echo($ET['ADRESSE1']) ?></td>
            <?php if ($_SESSION['NIV'] == 0) { ?>
                <td><a href="supprimerEleve.php?code=<?php echo($ET['CODE']) ?>" class="bouton">Supprimer</a></td>
                <td><a href="editEleve.php?code=<?php echo($ET['CODE']) ?>" class="bouton">Editer</a></td>
            <?php } ?>
        </tr>
    <?php } ?>
</table>
</body>
</html>


--
www.tremvi.com www.bawolo.com www.biz243.com

3 réponses

  1. Sur ma petite appli pour ecole. Il y a sur la page les élèves de toutes les classes. Je souhaiterai qu'il y ait la possibilité par menu déroulant de sélectionner une classe et que cela ne fasse apparaitre que les élèves de la classes sélectionnée dans le menu déroulant.
    1. Et ensuite envoyer la liste des élèves sur Excel?
    2. @KonseilSuis vraiment débutant
      Je tente d'apprendre sur le tas
  2. Salut,

    Une solution simple possible est d'ajouter dans ta page html un formulaire pointant sur la même page contenant la liste déroulante (balise select) des classes.
    Il te suffit ensuite de modifier ton code php pour récupérer la valeur sélectionnée dans la liste et de modifier la requête sql si cette valeur est définie.

    Bonne journée
    1. c'est un peu du chinois pour moi...
    2. Merci. je teste et je reviens vers vous. Dieu vous bénisse