Ciao a tutti ho questo codice
nella pagine insert.php
e questo codice
nella pagina insert_data.php
il mio problema e' che se nella pagina insert_data.php aggiungo dei valori non inserisce nessun dato, se cancello tra le parentesi tonde il set e il '$_POST[set]' magicamente funzione.. la stessa cosa me lo fa con il comdando UPDATE. Ci sono limitazioni per questi due comandi?
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.<br>Campo NOME deve essere compilato!";
}
}
echo "<br><br>";
echo $message;
?>
<table> <br> <br>
<form action="insert_data.php" method="POST"> <tr> <td>Nome</td> <td>
<input type="text" maxlength="10" name="nome" /><br></td</tr> <tr> <td>Gen</td> <td> <input type="text" maxlength="1" name="gen" /><br></td></tr> <tr> <td>Feb</td> <td> <input type="text" maxlength="1" name="feb" /><br></td></tr> <tr> <td>Mar</td> <td> <input type="text" maxlength="1" name="mar" /><br></td></tr> <tr> <td>Apr</td> <td> <input type="text" maxlength="1" name="apr" /><br></td></tr> <tr> <td>Mag</td> <td> <input type="text" maxlength="1" name="mag" /><br></td></tr> <tr> <td>Giu</td> <td> <input type="text" maxlength="1" name="giu" /><br></td></tr> <tr> <td>Lug</td> <td> <input type="text" maxlength="1" name="lug" /><br></td></tr> <tr> <td>Ago</td> <td> <input type="text" maxlength="1" name="ago" /><br></td></tr> <tr> <td>Set</td> <td> <input type="text" maxlength="1" name="set" /><br></td></tr> <tr> <td>Ott</td> <td> <input type="text" maxlength="1" name="ott" /><br></td></tr> <tr> <td>Nov</td> <td> <input type="text" maxlength="1" name="nov" /><br></td></tr> <tr> <td>Dic</td> <td> <input type="text" maxlength="1" name="dic" /><br></td></tr> <tr><td><br>
<input type="submit" value="inserisci" /></td</tr> </form> </table>
<?php
HtmlFooter();
?>
nella pagine insert.php
e questo 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,set) VALUES ('$_POST[nome]','$_POST[gen]','$_POST[feb]','$_POST[mar]','$_POST[apr]','$_POST[mag]','$_POST[giu]','$_POST[lug]','$_POST[ago]','$_POST[set]')";
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 dei valori non inserisce nessun dato, se cancello tra le parentesi tonde il set e il '$_POST[set]' magicamente funzione.. la stessa cosa me lo fa con il comdando UPDATE. Ci sono limitazioni per questi due comandi?