Voila mes code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
	'http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='fr' lang='fr'>
 
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="livredor.css" type="text/css" />
	<title>Livre d'Or</title>
</head>
 
<body>
 
	<h3> Laissez votre opinion ici! </h3>
	<hr />
 
<form action="commentaires.php" method="post">
 
<table>
<tr>
	<td><label for="nom">Nom :</label></td>
	<td><input type="text" class="txt" name="nom" id="nom" value="" /></td>
</tr>
<tr>
	<td><label for="email">Email (facultatif):</label></td>
	<td><input type="text" class="txt" name="email" id="email" value="" /></td>
                </tr>
</table>
 
<p>
	<label for="commentaire">Commentaire :</label><br />
	<textarea class="txt" id="commentaire" name="commentaire" cols="50" rows="10"></textarea>
</p>
 
<input type="submit" value="Ajouter" /></p>
 
</form>
 
 
 
</body>
 
</html>
Et voila le php permettant d'enregistrer dans ma base sql :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
	'http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='fr' lang='fr'>
 
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="livredor.css" type="text/css" />
	<title>Livre d'Or</title>
</head>
 
<body>
 
	<h3> Laissez votre opinion ici! </h3>
	<hr />
 
<?php
$connexion = mysql_connect("localhost","chabaro","chabaro");
mysql_select_db("chabaro", $connexion);
$date = date("d-m-Y");
$nom="'".mysql_escape_string($_REQUEST['nom'])."'"; 
$email="'".mysql_escape_string($_REQUEST['email'])."'"; 
$com="'".mysql_escape_string($_REQUEST['commentaire'])."'"; 
if( empty($nom) || empty($com))
{
echo "Vous n'avez pas renseigné toutes les informations nécessaires.";
}
else
{
mysql_query("INSERT INTO commentaires(Date, Nom, Email, Commentaire) VALUES('$date','$nom','$email','$com')",$connexion) or die (mysql_error()); 
echo"Votre commentaire a bien ete posté.";
mysql_close($connexion); 
}
 
?>
</body>
</html>
Et l'erreur etant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'fhj'',''dgh'',''hg'')' at line 1
Et meme si je ne rentre pas de nom ou de commentaire il m'affiche cette erreur or il devrait m'afficher :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
"Vous n'avez pas renseigné toutes les informations nécessaires."
Merci de m'aider.