<?php
if(isset($_POST['submit'])) {
$connessione=mysql_connect("127.0.0.1", "Oswold", "")
or die ("Non riesco a connettermi");
$db=mysql_select_db ("Test");
if (!$db)
{
die ("Connessione al db fallita!".mysql_error());
}
$user=$_POST['user'];
$pass=$_POST['pass'];
$mail=$_POST['email'];
$risultato=mysql_query("INSERT INTO utenti (username,password,mail) VALUES ('$user', '$pass', '$mail')") or die(mysql_error());
//Vediamo se passa i dati
echo $user. " - ".$pass." - ".$mail."<br><br>";
if($risultato){
echo "Registrazione avvenuta correttamente<br>";
}else{
echo "ERRORE riprova<br>";
}
}
?>
<html>
<body>
<form method="post" action="index.php">
<table border="1">
<tr><td>
<p><label><b>User:</b><br>
<input name="user" type="text">
</label></p>
<p><label><b>Email:</b><br>
<input name="email" type="text">
</label></p>
<p><label><b>Password:</b> <br>
<input name="pass" type="password">
</label></p>
</td></tr>
</table>
<br>
<input name="submit" type="submit" value="Registrati">
</form>
</body>
</html>