ah scusa beh allora

<?php
$id = $_REQUEST['id'];
if ($id) $id_cat = $_REQUEST['id_cat'];
?>
<html>
<head><title></title></head>
<body>
<form id="tabella" method="post" action="<?=$_SERVER['PHP_SELF']?>?id=1">
<?php
$link=mysql_connect('localhost', 'username', 'password');
mysql_select_db('database', $link);
if (!$id) {
$result = mysql_query("SELECT * from categorie ORDER BY Nome");
if (mysql_num_rows($result)) {
echo "<table border=\"0\" width=\"100%\"><tr>";
while ($row=mysql_fetch_assoc($result))
echo "<td onclick=\"document.forms[0].action='<?=$_SERVER['PHP_SELF']?>?id=1&amp;id_cat=".$row['ID_Cat']."\">".$row['Nome']."</td>";
echo "</tr></table>";
}
} else {
$result = mysql_query("SELECT * from subCat WHERE ID_Cat=$id_cat ORDER BY Nome");
echo "<table border=\"0\" width=\"100%\"><tr>";
if (mysql_num_rows($result)) {
echo "<table border=\"0\" width=\"100%\"><tr>";
while ($row=mysql_fetch_assoc($result))
echo "<td>".$row['Nome']."</td>";
echo "</tr></table>";
}
}
mysql_free_result($result);
mysql_close($link);
?>
</form>
</body>
</html>