Bonsoir,
Je souhaiterai changer une partie du script ci-dessous.
Je voudrai changer une partie du script (haut de page entre les pointillés) soit changer un moteur de recherche par un un menu à choix multiples.
La contrainte c'est qu'il me faut reprendre le paramétrage du moteur existant et l'adapter à un menu déroulant à choix multiple comparable à celui qui existe (juste en dessous dans la page)
Est-ce possible ?
Merci pour votre aide.
Eric G
<?
// search form and results
extract($config);
$kw = '';
extract($_REQUEST);
?>
<form method="get" name="search" action="<? echo $searchURL; ?>">
<input type="hidden" name="a" id="a" value="<? echo $_REQUEST['a']; ?>">
-----------------------------------------------------------------------------------------------------------------------------
<strong><?=$lang['searchkey'];?>:</strong> <input type="text" name="kw" id="kw" size="45" value="<? echo $kw; ?>" /> <input type="submit" name="submit" value="<?=$lang['srchgo'];?>" />
-----------------------------------------------------------------------------------------------------------------------------
<div><p>
<i>Saisir de préférence: maison, appartement, moulin, ferme, terrain, immeuble, local commercial, location.</i>
</p>
</div>
<br /><br />
<fieldset>
<table width="100%" border="0">
<tr>
<td><strong><?=$lang['srchcrt4'];?>:</strong> <select name="price" id="price"><option value="0" selected="selected"><?=$lang['srchcrt7'];?></option><option value="1"><?=$lang['srchcrtprice1'];?></option><option value="2"><?=$lang['srchcrtprice2'];?></option><option value="3"><?=$lang['srchcrtprice3'];?></option><option value="4"><?=$lang['srchcrtprice4'];?></option><option value="5"><?=$lang['srchcrtprice5'];?></option><option value="6"><?=$lang['srchcrtprice6'];?></option></select></td>
<td><strong><input type="submit" name="submit" value="<?=$lang['srchgo'];?>" /></td>
</tr>
<tr>
</table>
</fieldset>
</form>
<hr size="2" style="visibility:visible; display:block;" />
<?
if(isset($_REQUEST['submit']) && !empty($_REQUEST['submit'])){
// build the search query this could get messy
$sql = "SELECT * FROM ".$phprealty->db."property ";
if(!empty($kw)){
$sql2 .= "(title LIKE '%$kw%' OR full_desc LIKE '%$kw%') ";
}
if(!empty($price) && $price > 0 && $price <= 6){
// first get the correct amounts
switch($price){
case 1:
$psql = "price BETWEEN 0 and 50000";
break;
case 2:
$psql = "price BETWEEN 50000 and 100000";
break;
case 3:
$psql = "price BETWEEN 100000 and 200000";
break;
case 4:
$psql = "price BETWEEN 200000 and 500000";
break;
case 5:
$psql = "price BETWEEN 500000 and 750000";
break;
case 6:
$psql = "price >= 750000";
break;
}
if(!empty($sql2)){
$sql2 .= "AND ".$psql." ";
}else{
$sql2 .= $psql." ";
}
}
// query string to get num rows to set the limit
$sql3 = "SELECT id FROM ".$phprealty->db."property ";
if(!empty($sql2)){
$sql3 .= "WHERE ".$sql2;
}
if(!empty($sql2)){
$sql .= "WHERE ".$sql2;
}
if(!$result = $phprealty->dbQuery($sql3)){
echo $lang['nomatch'];
}else{
//echo $sql3;
$nums = mysql_num_rows($result);
$a = mysql_num_rows($result);
// include the pagination script
include(INC."PaginateIt.php");
//$PaginateIt = new PaginateIt();
$PaginateIt->SetItemsPerPage(2);
$PaginateIt->SetItemCount($a);
$PaginateIt->SetLinksFormat( '<<', ' | ', '>>' );
$res = $phprealty->dbQuery($sql." ".$PaginateIt->GetSqlLimit());
if(mysql_num_rows($res) < 1){
echo $lang['nomatch'];
}else{
// include currency converter / formater
include(INC."curr_conv.class.php");
$cf = new CurrencyFormatter();
?>
<div class="SearchTitle"><?=$lang['srchrez'];?></div>
<div id="listings">
Modifié par egibault (16 Jan 2009 - 17:03)
Je souhaiterai changer une partie du script ci-dessous.
Je voudrai changer une partie du script (haut de page entre les pointillés) soit changer un moteur de recherche par un un menu à choix multiples.
La contrainte c'est qu'il me faut reprendre le paramétrage du moteur existant et l'adapter à un menu déroulant à choix multiple comparable à celui qui existe (juste en dessous dans la page)
Est-ce possible ?
Merci pour votre aide.
Eric G
<?
// search form and results
extract($config);
$kw = '';
extract($_REQUEST);
?>
<form method="get" name="search" action="<? echo $searchURL; ?>">
<input type="hidden" name="a" id="a" value="<? echo $_REQUEST['a']; ?>">
-----------------------------------------------------------------------------------------------------------------------------
<strong><?=$lang['searchkey'];?>:</strong> <input type="text" name="kw" id="kw" size="45" value="<? echo $kw; ?>" /> <input type="submit" name="submit" value="<?=$lang['srchgo'];?>" />
-----------------------------------------------------------------------------------------------------------------------------
<div><p>
<i>Saisir de préférence: maison, appartement, moulin, ferme, terrain, immeuble, local commercial, location.</i>
</p>
</div>
<br /><br />
<fieldset>
<table width="100%" border="0">
<tr>
<td><strong><?=$lang['srchcrt4'];?>:</strong> <select name="price" id="price"><option value="0" selected="selected"><?=$lang['srchcrt7'];?></option><option value="1"><?=$lang['srchcrtprice1'];?></option><option value="2"><?=$lang['srchcrtprice2'];?></option><option value="3"><?=$lang['srchcrtprice3'];?></option><option value="4"><?=$lang['srchcrtprice4'];?></option><option value="5"><?=$lang['srchcrtprice5'];?></option><option value="6"><?=$lang['srchcrtprice6'];?></option></select></td>
<td><strong><input type="submit" name="submit" value="<?=$lang['srchgo'];?>" /></td>
</tr>
<tr>
</table>
</fieldset>
</form>
<hr size="2" style="visibility:visible; display:block;" />
<?
if(isset($_REQUEST['submit']) && !empty($_REQUEST['submit'])){
// build the search query this could get messy
$sql = "SELECT * FROM ".$phprealty->db."property ";
if(!empty($kw)){
$sql2 .= "(title LIKE '%$kw%' OR full_desc LIKE '%$kw%') ";
}
if(!empty($price) && $price > 0 && $price <= 6){
// first get the correct amounts
switch($price){
case 1:
$psql = "price BETWEEN 0 and 50000";
break;
case 2:
$psql = "price BETWEEN 50000 and 100000";
break;
case 3:
$psql = "price BETWEEN 100000 and 200000";
break;
case 4:
$psql = "price BETWEEN 200000 and 500000";
break;
case 5:
$psql = "price BETWEEN 500000 and 750000";
break;
case 6:
$psql = "price >= 750000";
break;
}
if(!empty($sql2)){
$sql2 .= "AND ".$psql." ";
}else{
$sql2 .= $psql." ";
}
}
// query string to get num rows to set the limit
$sql3 = "SELECT id FROM ".$phprealty->db."property ";
if(!empty($sql2)){
$sql3 .= "WHERE ".$sql2;
}
if(!empty($sql2)){
$sql .= "WHERE ".$sql2;
}
if(!$result = $phprealty->dbQuery($sql3)){
echo $lang['nomatch'];
}else{
//echo $sql3;
$nums = mysql_num_rows($result);
$a = mysql_num_rows($result);
// include the pagination script
include(INC."PaginateIt.php");
//$PaginateIt = new PaginateIt();
$PaginateIt->SetItemsPerPage(2);
$PaginateIt->SetItemCount($a);
$PaginateIt->SetLinksFormat( '<<', ' | ', '>>' );
$res = $phprealty->dbQuery($sql." ".$PaginateIt->GetSqlLimit());
if(mysql_num_rows($res) < 1){
echo $lang['nomatch'];
}else{
// include currency converter / formater
include(INC."curr_conv.class.php");
$cf = new CurrencyFormatter();
?>
<div class="SearchTitle"><?=$lang['srchrez'];?></div>
<div id="listings">
Modifié par egibault (16 Jan 2009 - 17:03)