Bonjour j'ai mis sur pied un moteur de recherche avec 2 select correspondant respectivement aux thèmes et aux auteurs. l'utilisateur a la possibilité de choisir uniquement un thème ou un auteur et les differents posts s'afficheront. ça marche separement si l'on selectionne soit le thème ou l'auteur le problème est que si l'on selectionne a la fois un auteur et un thème seul le dernier selecionné est excecuté. ```
<!DOCTYPE HTML>
<html class="no-js">
<head>
<!-- Basic Page Needs
================================================== -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>7 Avec Dieu -Adoration</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<!-- Mobile Specific Metas
================================================== -->
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="format-detection" content="telephone=no">
<!-- CSS
================================================== -->
<link href="css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="plugins/mediaelement/mediaelementplayer.css" rel="stylesheet" type="text/css">
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="plugins/prettyphoto/css/prettyPhoto.css" rel="stylesheet" type="text/css">
<!--[if lte IE 8]><link rel="stylesheet" type="text/css" href="css/ie8.css" media="screen" /><![endif]-->
<!-- Color Style -->
<link class="alt" href="colors/color1.css" rel="stylesheet" type="text/css">
<link href="style-switcher/css/style-switcher.css" rel="stylesheet" type="text/css">
<!-- SCRIPTS
================================================== -->
<script src="js/modernizr.js"></script><!-- Modernizr -->
</head>
<body class="boxed">
<!--[if lt IE 7]>
<p class="chromeframe">You are using an outdated browser. <a href="http://browsehappy.com/">Upgrade your browser today</a> or <a href="http://www.google.com/chromeframe/?redirect=true">install Google Chrome Frame</a> to better experience this site.</p>
<![endif]-->
<div class="body">

<!-- Start Site Header -->
<?php include "header.php";
include "comment.class.php";

?>

<!-- End Site Header -->
<!-- Start Nav Backed Header -->
<div class="nav-backed-header parallax" style="background-image:url(images/slide1.jpg);">
<div class="container">
<div class="row">
<div class="col-md-12">
<ol class="breadcrumb">
<li><a href="index.php">Accueil</a></li>
<li><a href="devotion.php">Dévotion matinale</a></li>
<li class="active">Adoration</li>
</ol>
</div>
</div>
</div>
</div>
<!-- End Nav Backed Header -->
<!-- Start Page Header -->
<div class="page-header">
<div class="container">
<div class="row">
<div class="col-md-12">
<h1>ADORATION</h1>
</div>
</div>
</div>
</div>
<!-- End Page Header -->
<!-- Start Content -->
<div class="main" role="main">
<div id="content" class="content full">
<div class="container">
<div class="row">
<div class="col-md-8 sermon-archive" style="">
<!-- contenu principal -->
<div class="devowrap">
<form action="#" method="post" class="form-ul">
<ul>
<li><select name="theme" class="form-control " id="theme" style="width:200px;">
<option value="" class="">Thème...</option>
<?php

                      try
                      {
                        require"connectionbd.php";
                        $req="select * from ad_theme order by titre";
                        foreach($bdd->query($req) as $r)
                        {
                          echo"<option value='".$r['id']."' class='themeop'>".$r['titre']."</option>";
                        }
                      }
                      catch(Exception $e)
                      {
                        die('Erreur : ' . $e->getMessage().' a la ligne '.$e->getLine().' dans le fichier '.$e->getFile());
                      }
                            ?>
                      </select></li>
                      <li><select name="group_chantre" class="form-control" id="orateurs" style="width:200px;">
                        <option value="">Groupes/Chantres...</option>
                          <?php
                            try
                            {
                              require"connectionbd.php";
                              $req="select id,nom_grp from ad_adoration order by nom_grp";
                              foreach($bdd->query($req) as $r)
                              {
                                $grp1class=explode(" ",$r['nom_grp']);
                                echo"<option value='".$r['id']."' class='".$grp1class[0]."'>".$r['nom_grp']."</option>";
                              }

                            }
                            catch(Exception $e)
                            {
                              die('Erreur : ' . $e->getMessage().' a la ligne '.$e->getLine().' dans le fichier '.$e->getFile());
                            }
                          ?>
                      </select></li>

                  </ul>
                  <div class="ligne"></div>
              </form>
        <div id="resu_devo">
          <div id="intern_devo" style="">
            <?php
            $class='';
              try
              {
                require"connectionbd.php";
                $req="select  * from ad_adoration where valider=1 and etat=1 order by date_ajout ";
                foreach($bdd->query($req) as $r)
                {
                  $u=$r['type'];
                  echo"<script>console.log($u);</script>";
                  $rex="select titre from ad_theme where id='".$r['theme']."'";
                  foreach($bdd->query($rex) as $l)
                  {
                    $theme1=explode(" ",$l['titre']); 
                    $datedevo=strtotime($r['date_ajout']);
                 $postdate=dateFrench($r['date_ajout']);
                 $grpclass=explode(" ",$r['nom_grp']);
                 $class=$theme1[0]." ".$grpclass[0];
                 $url="/7avecdieu/adoration_p.php?i=".$r['ownerid']."&id=".$r['id']."&type=".$r['type']."";                       

                 ?>
                 <article class="post sermon art-post <?php echo $class;?>" style="" >
          <header class="post-title">
            <div class="row">
              <div class="col-md-9 col-sm-9" style="width:350px;">
                <h3><a href="single-sermon.html"><?php echo strtoupper($r['titre']);?></a></h3>
                <span class="meta-data"><i class="fa fa-calendar"></i> Post&eacute;e <?php echo $postdate;?>| par: <a href="#"><?php echo $r['nom_grp'];?></a></span> </div>

            </div>
          </header>
          <div class="post-content">
            <div class="row">
              <?php
                $s=substr($r['photo'],0,3);
                $pic=$r['photo'];
                if($s=="../")
                  $pic=str_replace("../", "", $pic);

              ?>
              <div class="col-md-4"> <a href="single-sermon.html" class="media-box"> <img src="<?php echo $pic;?>" alt="" title="<?php echo $r['nom_grp'];?>" class="img-thumbnail"> </a> </div>
              <div class="col-md-8" style="overflow:hidden;">
                <p style="word-wrap:break-word;"><?php echo tronquer($r['descrip_grp'],270);?></p>
                <p><a href="adoration_p.php?i=<?php echo $r['ownerid'];?>&id=<?php echo $r['id'];?>&type=<?php echo $r['type']?>" class="btn btn-primary">En savoir plus <i class="fa fa-long-arrow-right"></i></a></p>
                <div class="themetag"><?php echo $r['theme'];?></div>
              </div>
            </div>
          </div>
        </article>
                <?php
              }

                  }

              }

               catch(Exception $e)
              {
                die('Erreur : ' . $e->getMessage().' a la ligne '.$e->getLine().' dans le fichier '.$e->getFile());
              }
            ?>

        </div>

      </div>

      </div>
      </div>
      <!-- sidebar contenu ici -->
    <?php include"menu_droit_standard.php";?>
    </div>
  </div>
</div>

</div>
<!-- Start Footer -->
<?php include "footer.php";?>
<!-- End Footer -->
</div>
<!-- Jquery Library Call -->
<script src="plugins/prettyphoto/js/prettyphoto.js"></script> <!-- PrettyPhoto Plugin -->
<script src="js/helper-plugins.js"></script> <!-- Plugins -->
<script type="text/javascript" src="js/custom-javascript.js"></script>
<script src="js/bootstrap.js"></script> <!-- UI -->
<script src="js/waypoints.js"></script> <!-- Waypoints -->
<script src="plugins/mediaelement/mediaelement-and-player.min.js"></script> <!-- MediaElements -->
<script src="js/init.js"></script> <!-- All Scripts -->
<script src="js/jquery.slimscroll.min.js"></script>
<script src="plugins/flexslider/js/jquery.flexslider.js"></script> <!-- FlexSlider -->
<script src="plugins/countdown/js/jquery.countdown.min.js"></script> <!-- Jquery Timer -->
<script src="style-switcher/js/jquery_cookie.js"></script>
<script src="style-switcher/js/script.js"></script>
<script>
$(document).ready(function(){

      (function($){

$.fn.showdelay = function(){
this.each(function(){
$(this).animate({"opacity":"1"},2200);
});
};
})(jQuery);

$('#intern_devo').slimscroll({
height: '700px'
});

$('#theme').change(function(){
var option=$("option:selected", this);
var nxt=option.text();
nxt=nxt.split(" ");
var a;
$('.art-post').each(function(){
if($(this).hasClass(nxt[0]))
{
a="."+nxt[0];
}
});
$('.art-post').fadeOut("slow");
$(a).show("fast");
});

var usedNames={};
$('#orateurs option').each(function(){
if(usedNames[this.text]) {
$(this).remove();
} else {
usedNames[this.text] = this.value;
}
});
$('#orateurs').change(function(){
var option=$("option:selected", this);
var clas=option.attr("class");
var a;
$('.art-post').each(function(){
if($(this).hasClass(clas))
{
a="."+clas;
}
});
$('.art-post').fadeOut("slow");
$(a).show("fast");
});

//afficher le theme au bas de page
$('.art-post').each(function(){

var themeid=$(this).find('.themetag').text();
var option=$('#theme option[value="' + themeid + '"]').text();
$(this).find('.themetag').html("<p class='tagstags'>"+option+"<p>");
});

});

</script>
<!-- Style Switcher Start -->
<?php include "style-switcher.php";?>
</body>
</html>

2 réponses


C'est juste illisible dans l'état.

Tu peux reprendre ton post afin de le formater correctement. Sinon personne ne prendra le temps de se pencher sur la question

@arnich +1