iserisci unOriginariamente inviato da gotiche
scusate, riposto il codice
questo e' il file insert_data.php
Codice PHP:<?php if (empty($_POST['nome']) )
{
header("Location: insert.php?alert=1");
die;
}
include "./connect.php";
$sql = "INSERT INTO telematici (nome,gen,feb,mar,apr,mag,giu,lug,ago) VALUES ('$_POST[nome]','$_POST[gen]','$_POST[feb]','$_POST[mar]','$_POST[apr]','$_POST[mag]','$_POST[giu]','$_POST[lug]','$_POST[ago]')";
mysql_query($sql, $conn);
header("Location: insert.php?alert=0");
?>e questo e' il file insert.phpCodice PHP:<?php include './page.php';
HtmlHeader();
Navigation();
$message = "";
if (isset($_GET['alert']))
{
if ($_GET['alert'] == 0)
{
$message = "Dati scritti correttamente nel database";
}
if ($_GET['alert'] == 1)
{
$message = "ERRORE: Nessun dato scritto nel database.
Campo NOME deve essere compilato!";
}
}
echo "
";
echo $message;
?>
<table>
<form action="insert_data.php" method="POST"> <tr> <td>Nome</td> <td>
<input type="text" maxlength="10" name="nome" />
</td</tr> <tr> <td>Gen</td> <td> <input type="text" maxlength="1" name="gen" />
</td></tr> <tr> <td>Feb</td> <td> <input type="text" maxlength="1" name="feb" />
</td></tr> <tr> <td>Mar</td> <td> <input type="text" maxlength="1" name="mar" />
</td></tr> <tr> <td>Apr</td> <td> <input type="text" maxlength="1" name="apr" />
</td></tr> <tr> <td>Mag</td> <td> <input type="text" maxlength="1" name="mag" />
</td></tr> <tr> <td>Giu</td> <td> <input type="text" maxlength="1" name="giu" />
</td></tr> <tr> <td>Lug</td> <td> <input type="text" maxlength="1" name="lug" />
</td></tr> <tr> <td>Ago</td> <td> <input type="text" maxlength="1" name="ago" />
</td></tr> <tr> <td>Set</td> <td> <input type="text" maxlength="1" name="set" />
</td></tr> <tr> <td>Ott</td> <td> <input type="text" maxlength="1" name="ott" />
</td></tr> <tr> <td>Nov</td> <td> <input type="text" maxlength="1" name="nov" />
</td></tr> <tr> <td>Dic</td> <td> <input type="text" maxlength="1" name="dic" />
</td></tr> <tr><td>
<input type="submit" value="inserisci" /></td</tr> </form> </table>
<?php
HtmlFooter();
?>
echo $sql;
così vedi cosa ti restituisce
per me l'errore è nella sintassi che viene creata
ciao

Rispondi quotando