l'inserimento è questo:
grazie per l'aiutocodice:<?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } $editFormAction = $HTTP_SERVER_VARS['PHP_SELF']; if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) { $editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING']; } if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "Inserisci")) { $insertSQL = sprintf("INSERT INTO news (titolo, testo) VALUES (%s, %s)", GetSQLValueString($HTTP_POST_VARS['Titolo'], "text"), GetSQLValueString($HTTP_POST_VARS['Testo'], "text")); mysql_select_db($database_Prova, $Prova); $Result1 = mysql_query($insertSQL, $Prova) or die(mysql_error()); } mysql_select_db($database_Prova, $Prova); $query_Recordset1 = "SELECT * FROM news ORDER BY id DESC"; $Recordset1 = mysql_query($query_Recordset1, $Prova) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%> <html> <head> <title>Documento senza titolo</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <form action="<?php echo $editFormAction; ?>" method="POST" name="Inserisci" id="Inserisci"> <input name="Titolo" type="text" id="Titolo"> <textarea name="Testo" wrap="VIRTUAL" id="Testo"></textarea> <input type="submit" name="Submit" value="Invia"> </p> <input type="hidden" name="MM_insert" value="Inserisci"> </form> </body> </html>

Rispondi quotando