hO RISolto in questo modo :
Codice PHP:
<?
//definisco le variabili per l'insert nel db
$categoria = ltrim(rtrim(strip_tags(stripslashes($_POST['categoria']))));
$cucinaq = ltrim(rtrim(strip_tags(stripslashes($_POST['cucinaq']))));
$pulizia = ltrim(rtrim(strip_tags(stripslashes($_POST['pulizia']))));
$cortesia = ltrim(rtrim(strip_tags(stripslashes($_POST['cortesia']))));
$provincia = ltrim(rtrim(strip_tags(stripslashes($_POST['provincia']))));
$telefono = ltrim(rtrim(strip_tags(stripslashes($_POST['telefono']))));
$nomelocale = ltrim(rtrim(strip_tags(stripslashes($_POST['nomelocale']))));
$indirizzo = ltrim(rtrim(strip_tags(stripslashes($_POST['indirizzo']))));
$comune = ltrim(rtrim(strip_tags(stripslashes($_POST['comune']))));
$chiusura = ltrim(rtrim(strip_tags(stripslashes($_POST['chiusura']))));
$prezzomedio = ltrim(rtrim(strip_tags(stripslashes($_POST['prezzomedio']))));
$vini = ltrim(rtrim(strip_tags(stripslashes($_POST['vini']))));
$posti = ltrim(rtrim(strip_tags(stripslashes($_POST['posti']))));
$tipocucina = ltrim(rtrim(strip_tags(stripslashes($_POST['tipocucina']))));
$prenotazione = ltrim(rtrim(strip_tags(stripslashes($_POST['prenotazione']))));
$dehor = ltrim(rtrim(strip_tags(stripslashes($_POST['dehor']))));
$fumo = ltrim(rtrim(strip_tags(stripslashes($_POST['fumo']))));
$parking = ltrim(rtrim(strip_tags(stripslashes($_POST['parking']))));
$cartecredito = ltrim(rtrim(strip_tags(stripslashes($_POST['cartecredito']))));
$linguaggio = ltrim(rtrim(strip_tags(stripslashes($_POST['linguaggio']))));
$descrizione = ltrim(rtrim(strip_tags(stripslashes($_POST['descrizione']))));
//faccio il controllo delle opzioni attive prima di andare a fare la queri di selezione nel databas
$where_clause = " and ";
if ($categoria!=""){if (isset($_POST['categoria']))
$where_clause .= " categoria='$categoria' AND ";}
if ($cucinaq!=""){if (isset($_POST['cucinaq']))
$where_clause .= " cucinaq='$cucinaq' AND ";}
if ($pulizia!=""){if (isset($_POST['pulizia']))
$where_clause .= " pulizia='$pulizia' AND ";}
if ($cortesia!=""){if (isset($_POST['cortesia']))
$where_clause .= " cortesia='$cortesia' AND ";}
if ($chiusura!=""){if (isset($_POST['chiusura']))
$where_clause .= " chiusura='$chiusura' AND ";}
if ($prezzomedio!=""){if (isset($_POST['prezzomedio']))
$where_clause .= " prezzomedio='$prezzomedio' AND ";}
if ($vini!=""){if (isset($_POST['vini']))
$where_clause .= " vini='$vini' AND ";}
if ($posti!=""){if (isset($_POST['posti']))
$where_clause .= " posti='$posti' AND ";}
if ($tipocucina!=""){if (isset($_POST['tipocucina']))
$where_clause .= " tipocucina='$tipocucina' AND ";}
if ($prenotazione!=""){if (isset($_POST['prenotazione']))
$where_clause .= " prenotazione='$prenotazione' AND ";}
if ($dehor!=""){if (isset($_POST['dehor']))
$where_clause .= " dehor='$dehor' AND ";}
if ($fumo!=""){if (isset($_POST['fumo']))
$where_clause .= " fumo='$fumo' AND ";}
if ($parking!=""){if (isset($_POST['parking']))
$where_clause .= " parking='$parkin' AND ";}
if ($cartecredito!=""){if (isset($_POST['cartecredito']))
$where_clause .= " cartecredito='$cartecredito' AND ";}
if ($linguaggio!=""){if (isset($_POST['linguaggio']))
$where_clause .= " linguaggio='$linguaggio' AND ";}
$where_clause .= " 0 = 0";
// echo "$where_clause";
/* include("configsearch.php");
$link = mysql_connect($dbhost,$dbuser,$dbpass);
if (! $link)
die("Could Not Connect To MySQL");
mysql_select_db($db) or die("Could Not Select Database, Is DVDlib Installed?");
$query = mysql_query("SELECT * FROM ristoranti WHERE provincia='$provincia' '$where_clause'");
echo "
";
while($row = mysql_fetch_array($query)) {
$foundtitle = $row["nomelocale"];
?>
<?
*/
//Stampa Pagina Html principale
include "config.php";
$db = mysql_connect("$server", "$username", "$password");
mysql_select_db("$database",$db);
$sql_recipe = "SELECT * FROM ristoranti WHERE provincia='$provincia'". $where_clause;
if (!$exec_recipe = mysql_query($sql_recipe))
{
echo "
" . MSG_RECIPE_NO_RETRIEVE ."
\n" . mysql_error();
}
while ($data = mysql_fetch_object($exec_recipe))
{
// echo "<table width=100% border=0>";
echo "<tr><td><h2>Profilo di $data->nomelocale</h2></tr></td>\n";
/*if (!empty($data->image))
{
//echo "<div align=center><img src=\"images/$data->image\" alt=\"$data->name\"></div>\n";
} */
//echo "<table width=100% border=1>";
//inizio mia tabella
;
}
?>