salve a tutti,
Sono principiante in php ;sto cercando di fare un sito con un form per la registrazione dei clienti .Uso php 4.1.0 e mysql 1.5
il problema e che il server mi dice "impossibile effettuare la query" indipendentemente dal fatto che i campi siano riempiti o no.ecco il codice per il file registrazionecliente.htm:
codice:
<head>
<title></title>
</head>
<body>
<table width="800" border="0">
<tr>
<td><form name='client' method="post" >
<table width="800" border="0">
<tr>
<td>idcliente</td>
<td colspan="3"><input name="idcliente" type="text" size="20" maxlength="20"></td>
</tr>
<tr>
<td>nom</td>
<td colspan="3"><input name="nome" type="text" size="40" maxlength="20"></td>
</tr>
<tr>
<td>prenom</td>
<td colspan="3"><input name="cognome" type="text" size="40" maxlength="20"></td>
</tr>
<tr>
<td
..........
</td>
<td colspan="3.....</td>
</tr>
<tr>
<td></td>
<td colspan="3"></td>
</tr>
<tr>
<td><input name="button" type=button onClick="location.href='cliente.php'" value="invia"></td>
<td><input name="button2" type=button onClick="location.href='modifica.php'" value="Modifica registrazione"></td>
<td><input name="reset" type="reset" value="reset"></td>
<td><input type=button onClick="location.href='cancella.php'" name="cancella" value="effacer enregistrement" ></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</body>
</html>
questo e il codice del file cliente.php
codice:
<?php
if (empty($idcliente) or empty($nome) or empty($cognome))
{
$conn = mysql_connect("localhost", "", "")
or die("Connessione al database fallita!");
mysql_select_db("AgenziaViaggi") or die("Database non trovato!");
$sql = "INSERT INTO client(idcliente, nome, cognome) VALUES('$idcliente', '$nome', '$cognome')";
$ris = mysql_query($sql) or die("impossibile effectuare la query!");
mysql_close();
;
}
else
{
include("registrazione.htm");
echo"<script>alert(\"compila tutti i campi obbligatori.'\);</script>
";
}
include("pagina.htm");
echo"
";
echo"
";
echo"
";
echo"
";
echo"
";
echo"
";
echo"
";
echo"
";
echo"<p align='center'>";
echo"può prenotare il suo viaggio qua";
echo"</p>";
?>
qualcuno mi sa dire qual'è il problema