Qualcosa del genere?
search.php
codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento senza titolo</title>
</head>
<body>
<form name="performsearch" action="performsearch.php" method="post">
Nome: <input type="text" name="nome" />
Cognome: <input type="text" name="cognome" />
Telefono: <input type="text" name="telefono" />
Via: <input type="text" name="via" />
Prodotto: <input type="text" name="prodotto" />
Tipo: <input type="text" name="type" />
Seriale: <input type="text" name="sn" />
Descrizione Guasto: <input type="text" name="descrizioneguasto" />
Note: <input type="text" name="note" />
<input type="submit" value="Cerca" />
</form>
</body>
</html>
performsearch.php
codice:
<?php
$where = "";
foreach($_POST as $key => $value) {
$where .= ($value != "" ? ($where != "" ? " AND $key = $value" : "$key = $value") : "");
}
echo("Where: $where");
?>
Ti resta di fare la query invece di stampare la clausola WHERE come nel mio codice