Codice PHP:
/* -- Connessione al Database dei Commenti -- */
include 'database_commenti.php';
/* -- Inserimento del Commento -- */
if(count($_POST) > 0)
{
$ip = $_SERVER['REMOTE_ADDR'];
$agent = $_SERVER['HTTP_USER_AGENT'];
$date_db = time();
if(!empty($_POST['commento']))
{
/* -- Settiamo il Commento -- */
$commento = htmlentities($_POST['commento']);
/* -- Impostiamo la Query -- */
$db_commenti_sec = "INSERT INTO " . $sec . " (filename_code_extension, nickname, commento, userIP, country, date, agent) ";
$db_commenti_sec.= "VALUES ('$sourceID', '$username', '$commento', '$ip', '$country', '$date_db', '$agent')";
/* -- Salvataggio dei Dati nel DataBase -- */
$write = mysql_query ($db_commenti_sec) or die (mysql_error());
if ($write === FALSE) $status = "Errore nel salvataggio del Commento. Riprova.";
else $status = "Il commento è stato inserito correttamente";
/* -- Distruggiamo la Variabile Commento -- */
unset($_POST['commento']);
}
else
{
/* -- Commento Vuoto | Errore -- */
$status = "[b]Inserisci il Testo del Commento![/b] (max 250 caratteri)";
}
}
Inserisce il commento e poi alla fine distrugge la variabile $_POST['commento']
ma cio sembra non accadere perche ad ogni refresh della pagina mi inserisce lo stesso commento, cioè sempra non distruggere la variabile.
Come mai?