Ho ripulito un po' il codice; questo è un esempio :
Codice PHP:
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formData")) {
$insertSQL = "INSERT INTO eventi (nome, `data`, descrizione, foto) VALUES ('".$_POST['nome']."','".$_POST['data']."','".$_POST['descrizione']."','".$_POST['img1']."')";
mysql_select_db($database_gta, $gta);
$Result1 = mysql_query($insertSQL, $gta) or die(mysql_error());
}
e il form:
<form id="form1" name="form1" method="POST" enctype="multipart/form-data" action="<?php echo $editFormAction; ?>">
<label>
<input type="file" name="img1"/>
</label>
<label>
<input type="text" name="nome" id="nome" />
</label>
</p>
<label>
<input type="text" name="data" id="data" />
</label></p>
<label>
<input type="text" name="descrizione" id="descrizione" />
<input type="submit" name="invia" id="invia" value="Submit" />
</label>
<input type="hidden" name="MM_insert" value="form1" />
</form>