Forum Moderators: coopster
<b>form.html</b>
<html>
<body>
<div align="center">
<p><font size="6"><strong><font color="#0000FF">Form di prova</font></strong></font>
<font color="#0000FF"><strong> </strong></font></p>
<p> </p>
</div>
<form method="post" action="install.php">
<p align="center"><font color="#0000FF" size="5"><strong><font size="4">E-mail:
<input type="text" name="email">
</font></strong></font></p>
<p align="center"><font color="#0000FF" size="5"><strong><font size="4">Nome :
<input type="text" name="nome">
</font></strong></font></p>
<p align="center"><font color="#0000FF" size="5"><strong><font size="4">Cognome :
<input type="text" name="cognome">
</font></strong></font></p>
<p align="center"><font color="#0000FF" size="5"><strong><font size="4">Codice Fiscale :
<input type="text" name="codfisc">
</font></strong></font></p>
<p align="center"><font color="#0000FF" size="5"><strong><font size="4">Telefono:
</font></strong></font><font size="4"><strong>
<input type="text" name="telefono">
<br>
</strong></font> </p>
<p align="center">
<input type="submit" value="Invia">
</p>
</form>
<div align="center">
</div>
</body>
</html>
install.php
<HTML>
<HEAD><TITLE>Inserimento dati personali</TITLE></HEAD><BODY>
<?php
$db_host = "myhost";
$db_name = "mydb";
$db_user = "user";
$db_password = "password";
$db = mysql_connect ($db_host, $db_user, $db_password);
if ($db == FALSE)
die ("Errore nella connessione");
print ("Connesso con successo");
mysql_select_db ($db_name)
or die ("<br>Errore nella selezione del database</br>");
print ("<br>Database selezionato</br>");
$email="email";
$nome= "nome";
$cognome= "cognome";
$codfisc="codfisc";
$telefono="telefono";
$query = "INSERT INTO personal (email, nome, cognome, codfisc, telefono) VALUES ('$email','$nome','$cognome','$codfisc','$telefono')";
//echo $query;
//echo $db;
if ($result = mysql_query ($query,$db))
{ echo "<br>L'inserimento è avvenuto con successo</br>";}
else { echo "<br>L'inserimento NON è avvenuto con successo</br>"; }
mysql_close($db);
?>
</BODY>
</HTML>
THANKS!
My guess is your register globals [php.net] is off. You'll need to access your post variables with the $_POST [php.net] superglobal. For example, you can get the email variable by $email = $_POST['email'].
$email="email";
$nome= "nome";
$cognome= "cognome";
$codfisc="codfisc";
$telefono="telefono";
Which means that no matter what you type in your input fields, the value will always remain the same as you are assigning second values to each variable. This will over write whatever the value was originally.
:)