questa pagina è per l'inserimento modifica e cancellazione di tuple all'interno di un database sql.
mi da problemi la cancellazione. cioè da "elseif ($cosa=="del"){"
non mi cancella la tupla e mi esce scritto il messaggio che ho previsto per l'errore.
dipende da questo codice o è qualcos'altro?

Codice PHP:
<html>
<head>
<title>Gestione Film</title>
<link rel="stylesheet" href="mystyle.css">
</head>
<body>

<?php
error_reporting
(E_ALL E_NOTICE);
include_once(
"mysql_conn.php");

if (isset(
$_POST['key'])) $key $_POST['key'];
$cosa "";
if (isset(
$_POST['Mod'])) $cosa "mod";
if (isset(
$_POST['Del'])) $cosa "del";
if (isset(
$_POST['New'])) $cosa "new";
if (isset(
$_POST['goMod'])) $cosa "gomod";
if (isset(
$_POST['goDel'])) $cosa "godel";
if (isset(
$_POST['goNew'])) $cosa "gonew";

if (
$cosa == "") {

$query "SELECT * FROM film";

$ris mysql_query($query);

echo 
"<h1>Lista film</h1>";
echo <<<eof


 <form action="film2.php" method="post">
            <input type="hidden" name="key" value="
{$linea['idf']}" />
            <input type="submit" name="New" value="Nuovo film" />
        </form>
</p>
eof;
echo 
"<table>\n";
    while (
$linea mysql_fetch_array($risMYSQL_ASSOC)) {
        echo 
"\t<tr>\n";
        foreach (
$linea as $valore_colonna) {
            echo 
"\t\t<td>$valore_colonna</td>\n";
        }
        echo 
"\t\t<td>\n";
echo <<<eof
        <form action="film2.php" method="post">
            <input type="hidden" name="key" value="
{$linea['idf']}" />
            <input type="submit" name="Mod" value="Modifica" />
        </form>
eof;
        echo 
"\t\t<td>\n";
        echo <<<eof
        <form action="film2.php" method="post">
            <input type="hidden" name="key" value="
{$linea['idf']}" />
            <input type="submit" name="Del" value="Cancella" />
        </form>
eof;

    }
    echo 
"</table>";
echo <<<eof


 <form action="film2.php" method="post">
            <input type="hidden" name="key" value="
{$linea['idf']}" />
            <input type="submit" name="New" value="Nuovo film" />
        </form>
</p>
eof;

} elseif (
$cosa == "mod") {

$query_mod "SELECT * FROM film WHERE idf='$key'";
$ris_paz mysql_query($query_mod);
$fil_mod mysql_fetch_array($ris_pazMYSQL_ASSOC);

echo <<<eof
<h1>Modifica film</h1>
<h2>
{$fil_mod['nomef']}</h2>
<form action="film2.php" method="post">


IDF:
<input type="text" name="idf" value="
{$fil_mod['idf']}" />
</p>


Nome:
<input type="text" name="nomef" value="
{$fil_mod['nomef']}" />
</p>


Data:
<input type="text" name="data" value="
{$fil_mod['data']}" />
</p>


Genere1:
<input type="text" name="genere1" value="
{$fil_mod['genere1']}" />
</p>


Genere2:
<input type="text" name="genere2" value="
{$fil_mod['genere2']}" />
</p>



<input type="hidden" name="key" value="
{$fil_mod['idf']}" />
<input type="submit" name="goMod" value="Modifica" />
</p>
</form>

eof;
} elseif (
$cosa == "gomod") {

$idf $_POST['idf'];
$nomef $_POST['nomef'];
$data $_POST['data'];
$genere1 $_POST['genere1'];
$genere2 $_POST['genere2'];

$query_upd "UPDATE film SET idf=$idf,nomef='$nomef',data='$data',genere1='$genere1',genere2='$genere2' WHERE idf='$key'";

$ris mysql_query($query_upd);
if (
mysql_affected_rows()) {
    echo 
"

Modifica avvenuta con successo</p>

<a href=\"film2.php\" title=\"Torna lista\">Torna alla lista dei film</a></p>"
;
    } else {
    echo 
"

Problemi!</p>"
;
    }
    
}

elseif (
$cosa=="del"){

$query_can="SELECT * FROM film WHERE idf='$key'";
$ris=mysql_query($query_can);
echo 
"<table>\n";
    while (
$linea mysql_fetch_array($risMYSQL_ASSOC)) {
        echo 
"\t<tr>\n";
        foreach (
$linea as $valore_colonna) {
            echo 
"\t\t<td>$valore_colonna</td>\n";
        }
        echo 
"\t\t<td>\n";
}
echo <<<eof
<form action="film2.php" method="post">


<input type="hidden" name="keyd" value="
{$ris['idf']}" />
<input type="submit" name="goDel" value="Cancella" /></p>

</form>
eof;
}

elseif (
$cosa == "godel") {
$query_del "delete from film where idf='$keyd'";
$ris mysql_query($query_del);
if (
mysql_affected_rows()){
    echo 
"

Cancellazione avvenuta con successo</p>

<a href=\"film2.php\" title=\"Torna lista\">Torna alla lista dei film</a></p>"
;
    } else {
    echo 
"

Problemi con la cancellazione</p>"
;
    }
}

elseif (
$cosa=="new"){
echo <<<eof
<h1>Nuovo film</h1>

<form action="film2.php" method="post">


IDF:
<input type="text" name="idf" />
</p>


Nome:
<input type="text" name="nomef"  />
</p>


Data:
<input type="text" name="data" />
</p>


Genere1:
<input type="text" name="genere1"  />
</p>


Genere2:
<input type="text" name="genere2" />
</p>



<input type="submit" name="goNew" value="Salva Nuovo" />
</p>
</form>
eof;
}
elseif (
$cosa=="gonew"){
$idf $_POST['idf'];
$nomef $_POST['nomef'];
$data $_POST['data'];
$genere1 $_POST['genere1'];
$genere2 $_POST['genere2'];
$query_new "INSERT INTO film VALUES ($idf,'$nomef','$data','$genere1','$genere2')";

$ris mysql_query($query_new);
if (
mysql_affected_rows()) {
    echo 
"

Inserimento avvenuto con successo</p>

<a href=\"film2.php\" title=\"Torna lista\">Torna alla lista dei film</a></p>"
;
    } else {
    echo 
"

Problemi!</p>"
;
    }
    
}
?>
</body>
</html>