Bonjour,
Je suis nouvelle sur le site !
Je fais appel à vous car j’ai envisagé toutes les solutions et que là je n’avance plus du tt!
Je souhaiterais savoir où se situe mon problème, ou encore s’il y a quelque chose à modifier!
En fait mon formulaire est une recherche avancée, il récupère bien les données choisies mais j’ai l’impression que la requête de cumulation des choix ne se fait et surtout ne s’affiche pas !
function AdvancedSearchAds()
{
global $prefix,$db,$module_name,$bgcolor1,$bgcolor2,$perpage,$adsbgcolor1,$adsbgcolor2, $admin;
include ("header.php");
menu($mainads=1);
echo "<BR>";
OpenTable();
echo "<tr align=\"center\"><td colspan=\"2\"><font class=\"title\">Recherche Avancée</font><br><BR><BR><br></td></tr>";
echo "<tr align=\"center\">
<td>
<form name=\"formulaire\" align=\"center\" action=\"modules.php?name=$module_name&op=AdvancedSearchAds\" method=\"post\" enctype=\"multipart/form-data\">";
echo "<table>";
echo "<tr><td width=\"130\" align=\"center\"><font color=\"0080c0\">CATEGORIES</font></td>"
."<td width=\"120\" colspan=\"6\"><select name=\"catgforprocess\">";
$result = $db->sql_query("select id_catg,catg from ".$prefix."_ads_category order by catg");
while (list($xid_catg,$xcatg) = $db->sql_fetchrow($result)){
$result2 = $db->sql_query("select id_subcatg,subcatg from ".$prefix."_ads_subcatg where id_catg='$xid_catg' order by subcatg");
while (list($xid_subcatg,$xsubcatg) = $db->sql_fetchrow($result2)) {
echo "<option value=\"$xid_catg"."_"."$xid_subcatg\">$xcatg-$xsubcatg</option>\n";
}
$db->sql_freeresult($result2);
}
$db->sql_freeresult($result);
echo "</select>"
."</td></tr>";
echo "<TR align=\"center\" width=\"100%\">";
echo "<TD width=\"120\" align=\"center\">";
echo "<font color=\"0080c0\"<b>DEPARTEMENTS</b></font></td>";
echo "<td width=\"40\">";
echo "<select name=\"id_localisation1\">";
$result3 = $db->sql_query("select * from ".$prefix."_ads_localisation order by id_localisation");
while (list($id_localisation,$localisation) = $db->sql_fetchrow($result)) {
echo "<option value=\"$id_localisation\">$id_localisation</option>\n";
}
$db->sql_freeresult($result);
echo "</select></td>";
echo "<td width=\"40\">";
echo "<select name=\"id_localisation2\">";
$result4 = $db->sql_query("select * from ".$prefix."_ads_localisation order by id_localisation");
while (list($id_localisation,$localisation) = $db->sql_fetchrow($result)) {
echo "<option value=\"$id_localisation\">$id_localisation</option>\n";
}
$db->sql_freeresult($result);
echo "</select></td>";
echo "<td width=\"40\">";
echo "<select name=\"id_localisation3\">";
$result5 = $db->sql_query("select * from ".$prefix."_ads_localisation order by id_localisation");
while (list($id_localisation,$localisation) = $db->sql_fetchrow($result)) {
echo "<option value=\"$id_localisation\">$id_localisation</option>\n";
}
$db->sql_freeresult($result);
echo "</select></td>
</tr>";
echo "<TR align=\"center\">";
echo "<TD width=\"120\" align=\"center\">";
echo "<font color=\"0080c0\">DATE DE PARUTION</font></td>";
echo "<td>entre</td><td width=\"60\"><input type=\"text\" size=\"10\" name=\"dateposted1\" value=\"$dateposted\"></td>";
echo "<td>et</td><td width=\"60\"><input type=\"text\" size=\"10\" name=\"dateposted2\" value=\"$dateposted\"></td>";
echo "<td> ex : 2006-01-27</td></tr>";
echo "<tr align=\"center\"><td width=\"120\" align=\"center\"></td>";
echo "<td width=\"60\"><input type=\"hidden\" name=\"op\" value=\"AdvancedSearchAds\"></td>";
echo "<td width=\"60\"><input type=\"submit\" value=\"Recherche\"></td>";
echo "</tr></table></form></td></tr>";
CloseTable();
$ catgforprocess =$_POST[' catgforprocess '];
$ id_localisation =$_POST[' id_localisation1', ' id_localisation2', ' id_localisation3'];
$ dateposted =$_POST[' dateposted1', dateposted2'];
echo $ catgforprocess;
echo $ id_localisation;
echo $ dateposted;
OpenTable();
$catg_arr = explode("_",$catgforprocess);
$id_catg = $catg_arr[0];
$id_subcatg = $catg_arr[1];
$requete = "SELECT id_ads, id_catg, id_subcatg, id_localisation, title, cdesc, prize, submitter, email, website, dateposted ";
$requete .= " FROM ".$prefix."_ads_ads WHERE ";
$requete .= " catgforprocess = .$POST[catgforprocess]. ";
$requete .= " AND (id_localisation = .$POST[id_localisation1]. OR id_localisation = .$POST[id_localisation2]. OR id_localisation = .$POST[id_localisation3]. ) ";
$requete .= " AND (dateposted BETWEEN .$POST[dateposted1]. AND .$POST[dateposted2]. ) /*OR (dateposted => .$POST[dateposted1]. AND dateposted <= .$POST[dateposted2]. )";*/
$requete .= " ORDER BY id_ads DESC ";
$resulttotalads = $db->sql_query($requete);
$totalads = $db->sql_numrows($resulttotalads);
if ($totalads == 0) {
echo "<center><b>"._NOMATCHQUERY." <I></i></b></center>";
} else {
echo ""._THEREARE." <b>$totalads</b> "._FOUNDFOR." <b></b><BR><BR>";
$totalpages = ceil($totalads/$perpage);
if (!$page) {
$page = 1;
}
$start = ($page - 1) * $perpage;
$requete .= " limit $start,$perpage";
if ($totalpages >= 2) {
echo "<center>";
$back = $page - 1;
if ($back >= 1 ) {
echo "<a href=\"modules.php?name=$module_name&op=AdvancedSearchAds&page=$back2\" class=\"content\"><< "._BACK."</a> ";
}
for ($i = 1;$i <= $totalpages;$i++) {
if ($page == $i) {
echo "<b>$page</b> ";
} else {
echo "<a href=\"modules.php?name=$module_name&op=AdvancedSearchAds&page=$i\" class=\"content\">$i</a> ";
}
}
$next = $page + 1;
if ($next <= $totalpages) {
echo "<a href=\"modules.php?name=$module_name&op=AdvancedSearchAds&page=$next\" class=\"content\">"._NEXT." >></a>";
}
echo "</center>";
}
$resultads = $db->sql_query($requete);
$j=0;
while (list($id_ads,$id_catg,$id_subcatg,$id_localisation,$title,$cdesc,$prize,$submitter,$email,$website,$dateposted) =$db->sql_fetchrow($resultads)) {
$j++;
if ($j % 2 == 0) {
$backcolor = "$adsbgcolor1";
} else {
$backcolor = "$adsbgcolor2";
}
echo ""._WEBSITE." : <b>".$website."</b></a>"
." le ".FormatDate($dateposted);
echo "<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\" bgcolor=\"#333333\">"
."<tr bgcolor=\"$bgcolor2\"><td><font ><b>".ucfirst($title)."</b></font></td></tr>"
."<tr bgcolor=\"$backcolor\"><td>"
."<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"1\"><tr><td>".stripslashes($cdesc)."</td></tr>"
."<tr><td><b>"._PRICE." :</b> $prize</td></tr>"
echo "<tr><td><div align=\"center\">[ <a href=\"modules.php?name=Private_Messages&send=1&uname=$submitter\">"
.""._SENDPM." ".ucfirst($submitter)."</a> | <a href=\"modules.php?name=$module_name&op=ViewDetailAds&id_ads=$id_ads\">"._ADSDETAIL."</a> ";
echo "]</div>"
."</td></tr></table>";
echo "<tr bgcolor=\"$bgcolor2\"><td align=\"center\">";
echo AdsAdminBlock($no);
echo "</td></tr></table>";
echo "<BR>";
echo "<BR>";
}
$db->sql_freeresult($resultads);
if ($totalpages >= 2) {
echo "<center>";
$back = $page - 1;
if ($back >= 1 ) {
echo "<a href=\"modules.php?name=$module_name&op=AdvancedSearchAds&page=$back2\"><< "._BACK."</a> ";
}
for ($i = 1;$i <= $totalpages;$i++) {
if ($page == $i) {
echo "<b>$page</b> ";
} else {
echo "<a href=\"modules.php?name=$module_name&op=AdvancedSearchAds&page=$i\">$i</a> ";
}
}
$next = $page + 1;
if ($next <= $totalpages) {
echo "<a href=\"modules.php?name=$module_name&op=AdvancedSearchAds&page=$next\">"._NEXT." >></a>";
}
echo "</center>";
}
}
CloseTable();
include ("footer.php");
}
Merci d’avance à tous ceux qui pourront m’aider !!!!