questo è il codice praticamente completo
Codice PHP:
<?php if ($_POST['search'])
{
if (!empty($_POST['keywords']))
{ $searchStr = $_POST['keywords'];
if (preg_match("/^[0-9a-zA-Z\-\.àèìòùÀÈÌÒÙ'& ]+$/", $searchStr))
{
print "<h1>Risultati per \"$searchStr\":</h1> <div style=\"margin-top:50px\">
<ul class=\"motore\"> "; $keys = explode(" ", $searchStr); for ($x = 0; $x < count($keys); $x++) {
$sql = "SELECT * FROM tbl_servizi WHERE note LIKE '%$keys[$x]%'
OR nome_servizio LIKE '%$keys[$x]%'
OR sottotitolo LIKE '%$keys[$x]%' ";
$result = dbQuery($sql) or die('Si è verificato un errore' . mysql_error());
if ($frow = mysql_fetch_array($result))
{ $found = true;
do { echo"[*]<a href=\"index.php?id_ser=".$frow["id_servizio"]."\">". $frow["nome_servizio"] ."</a>\n";
}
while ($frow = mysql_fetch_array($result));
print("<input style=\"margin-top:20px\" name=\"nuova_ricerca\" type=\"button\" id=\"btnModifyProduct\" value=\"Nuova ricerca\" onclick=\"window.location.href='index.php';\"/>");
}
}