Ciao a tutti
Ho un problema con questo script piccolo
Il problema sta che non inserisci i campi nel db ho creato un database di nome provaalleanza con dentro una tabella di nome prova e con i campi nome cognome ecc ecc
Ma non riesce a inserirli qualcuno mi sa aiutare ?
Codice PHP:
<html>
<head>
<title>Inserimeto record alleanza</title>
</head>
<body>
<table>
<form method = "post" action = "ok.php">
<tr><td>Miniera</td>
<td><input type ="text" name = "asd" size ="20" maxlength = "20"></td></tr>
<tr><td>Nome</td>
<td><input type ="text" name = "nome" size ="20" maxlength = "20"></td></tr>
<tr><td>Azienda</td>
<td><input type ="text" name = "azienda" size ="20" maxlength = "20"></td></tr>
<tr><td>Ruolo</td>
<td><input type ="text" name = "ruolo" size ="20" maxlength = "20"></td></tr>
<tr><td colspan = "2"><input type = "submit" value ="inserisci"></td></td>
</form>
</table>
</body>
</html>
Codice PHP:
<html>
<head>
<title>Inserimento nel database</title>
</head>
<body>
<?php
$host = 'localhost';
$user = 'root';
$password = '';
$database = 'provaalleanza';
$db = mysql_connect($host, $user , $password) or die ("Impossibile connettersi al server $host");
$query = "INSERT INTO prova "."(asd , nome , azienda, ruolo)"."VALUES('".$_REQUEST[asd']."','".$_REQUEST['nome']."','".$_REQUEST['azienda']."','".$_REQUEST['ruolo']."')";
if (!mysql_query($query , $db))
{
print('attenzione , impossibile inserire il record');
}
else
{
print('ok');
}
mysql_close($db);
?>
</body>
</html>