ciao gente, premetto di essere niubbo totale.
vorrei creare un modulo con 4 campi che inserisca i valori in un databse.
il databse è creato, usiamo informazioni generiche:
my_databse
tb:errori è la tabella che vorrei riempire
my_username
my_password
perchè questo sciprt non inserisce i campi nel database?
premetto che ho fatto una summa di informazioni
codice:
<form method="POST" action="errori.php">
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="205">
<tr>
<td width="171" height="46">Nome del Film:</td>
<td height="46">
<select size="1" name="nome"
style="font-family: Trebuchet MS; border-style: solid;
border-width: 1px; padding-left: 4px; padding-right: 4px; padding-top: 1px; padding-bottom: 1px">
<option>La compagnia dell'anello</option>
<option>Le due torri</option>
<option>Il ritorno del re</option>
</select></td>
</tr>
<tr>
<td width="171" height="85">Errore riscontrato:</td>
<td height="85">
<textarea rows="5" name="errore" cols="33"></textarea></td>
</tr>
<tr>
<td width="171" height="37">Gravità:</td>
<td height="37"><input type="text" name="grav" size="20"></td>
</tr>
<tr>
<td width="171">Mittente:</td>
<td><input type="text" name="mittente" size="20"></td>
</tr>
</table>
</p>
<p style="text-align: center"><input type="submit" value="Invia" name="invia" style="font-family: Trebuchet MS">
<input type="reset" value="Resetta" name="reset" style="font-family: Trebuchet MS"></p>
<?php
$connessione = mysql_connect("my_databse","my_username","my_password")
or
die("Connection impossible, try later or contact the administrator");
mysql_select_db("my_lsdtolkien",$connessione);
if ($_POST['Submit'])
{
// Se tutti i campi sono inseriti
if ($_POST['errore'] == "") {
$msg = "Inserire l'errore riscontrato";
}
elseif ($_POST['gravi'] == "") {
$msg = "Inserire la gravità";
}
elseif ($_POST['mittente'] == "") {
$msg = "Inserire il mittente";
}
else
{
$nomefilm = $_POST['nome'];
$errorefilm = $_POST['errore'];
$gravita = $_POST['grav'];
$mitt = $_POST['mittente'];
$query = "INSERT INTO tb_errori (nome, errore, gravita, mittente) VALUES ('$nomefilm','$errorefilm','$gravita','$mitt')";
mysql_select_db($database_hb9faxdb, $hb9faxdb) or die ("Database non selezionato");
mysql_query($query) or die ('Error:'.mysql_error());
$msg = "Inserimento avvenuto con successo";
}
}
?>
</form>
</div>
grazie