Ciao a tutti io ho questo codice
Codice 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(); ?>
nella pagine insert.php
e questo codice
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"); ?>
nella pagina insert_data.php
il mio problema e' che se nella pagina insert_data.php aggiungo nella riga del INSERTO INTO altri valori non inserisce piu' nessun dato, cosa che fa con il codice che ho postato, la stessa cosa me lo fa con il comdando UPDATE. Ci sono limitazioni per questi due comandi?