codice:
<form action="?temp_view=ricerca_result.php3" method="POST">
<font color="FF9933">Cerca un gioco:</font>
<input align="middle" type="text" name="nome">
<input type="submit" align="center" name="submit" value="CERCA">
</form>
questo é il form di entrata.
Questo invece é la pagina che riceve i dati:
codice:
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<center>
<?php
/* This program gets news items from the database */
include("config.php");
$db = mysql_connect("$mysql_host", "$mysql_user", "$mysql_pass");
mysql_select_db("$mysql_name", $db);
if ($orderby == 'date'):
elseif (isset($submit)):
$sql = "select * from giochi where `nome` LIKE '%$nome%' order by `nome` limit 0, 100000000";
endif;
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
?>
<?
if ($num_rows >= "1") {print "Ci sono $num_rows risultati della ricerca di "$nome":";}
?>
<?
while ($row = mysql_fetch_array($result)) {
?>
<center>
<table border="0" cellpadding="0" cellspacing="0" width="443" height="160" id="table1">
<tr>
<td height="30" width="443" colspan="4">
<a target="_blank" href="<? print"../giochi/$row[desgioco]$row[extgioco]" ?>">
<font size="4" color="#FF6600"><? print"$row[nome]" ?></font></a></td>
</tr>
<tr>
<td height="19" width="113"><font color="#FF6600"><font size="2">Data</font>:
</font><? print"$row[data]" ?></td>
<td height="19" width="101"><font color="#FF6600"><font size="2">Ora</font>: </font><? print"$row[ora]" ?></td>
<td height="19" width="126"><font color="#FF6600"><font size="2">
Genere</font>:</font> <? print"$row[genere]" ?></td>
<td height="19" width="103"><font color="#FF6600"><font size="2">Voto</font>: </font><font size="4"><? print"$row[voto]" ?></font></td>
</tr>
<tr>
<td height="87" width="443" colspan="4">
">[img]<? print[/img]" width="80" height="70" align="left"><? print"$row[body]" ?></td>
</tr>
<tr>
<td width="443" colspan="4"><hr color="#FF6600"></td>
</tr>
</table>
<?
}
?>
<?
if ($num_rows == "") {print "Nessun gioco corrisponde alla parola "$nome".<a href=\"?temp_view=ricerca.php3\">Clicca qui per riprovare.</a>"; exit;}
?>
</center>
</center>
</body>
</html>