veramente ne ho trovato uno ma non funziona:


form

<form method="post" action="pagina.php">
<input type="text" name="nome" />Nome

<input type="text" name="commento" />Commento

<input type="submit" name="invia" value="Inserisci commento" />
</form>


pagina.php


<?
$nome = $_POST[“nome”]; $nome = str_replace(“|”,””,$nome);
$commento = $_POST[“commento”]; $commento = str_replace(“|”,””,$commento);
if($_POST["invia"]){
if(trim($nome) == “” || trim($commento) == “”) {
echo “Devi riempire tutti i campi!”;
}else{
$fp = fopen(“commenti.txt”,”a+”);
fwrite($fp, “$nome|$commento|\n”);
fclose($fp);
header(“Location: pagina.php”);
}
}
?>


dove vengono visti i commenti


<?
$file = file(“commenti.txt”);
foreach($file as $linea) {
$ex = explode(“|”,$linea);
$nome = $ex[0]; $commento = $ex[1];
echo “

Commento di $nome => $commento</p>”;
}
?>


e inoltre ovviamente il file commenti.txt




DITEMI VOI DOVE E' ERRATO???