J'ai deux page qui gèrent l'inscription à mon site :
inscription.php :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="fr" xml:lang="fr">
<head>
<script>
function countAdClick(id)
{
loadXMLDoc('./ads/click.php?a=' + id);
}
function countAdView(id)
{
loadXMLDoc('./ads/view.php?a=' + id);
}
function loadXMLDoc(url) {
req = false;
if(window.XMLHttpRequest) {
try {
req = new XMLHttpRequest();
} catch(e) {
req = false;
}
} else if(window.ActiveXObject) {
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
req = false;
}
}
}
if(req) {
req.open("GET", url, true);
req.send(null);
}
}
</script>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" media="screen" type="text/css" title="style" href="css/style.css" />
<title>titre</title>
</head>
<?
include ("includes/fil.php");
include ("includes/head.php");
include("includes/menu.php");
include ("includes/bandeau.php");
?>
<div id="corps">
<h1>Inscription</h1>
<hr/>
<html>
<head>
</head>
<body>
<form action="inscription_confirmation.php" method="post">
<table id="inscription">
<tr>
<th>Nom</th>
<th><input type="text" name="nom" /></th>
</tr>
<tr>
<th>Prénom</th>
<th><input type="text" name="prenom" /></th>
</tr>
</table>
<table id="inscription">
<tr>
<th>Pseudo :</th>
<th><input type="text" name="login" /></th>
</tr>
<tr>
<th>Adresse mail :</th>
<td><input type="text" name="mail" /></td>
</tr>
<tr>
<th>Mot de passe :</th>
<th><input type="password" name="pass" /></th>
</tr>
</table><br/>
<br/>
<table id="inscription">
<th>Centre(s) d'interêt(s) :</th>
<td><input type="text" name="interets" /></td>
</tr>
<th>Occupation(s) :</th>
<td><input type="text" name="occupations" /></td>
</tr>
<th>Vos motivations :</th>
<td><input type="text" name="motivations" /></td>
</tr>
</table><br/>
<table id="inscription">
<th>Autres informations</th>
<td><textarea row="200" cols="60" name="informations"></textarea></td>
</tr>
</table>
<h2><input type="submit" name="inscription" value="Inscription"><a decoration="none" href="http://radiatorust.fr/" target=""><input type="button" value="Annuler"></a></h2>
</form>
<?php
if (isset($erreur)) echo '<br />',$erreur;
?>
</body>
</html>
et inscription_confirmation.php :
<?php
include ("includes/sql.php");
?>
<?php
ini_set('mysql.trace_mode', true);
error_reporting(E_ALL | E_STRICT);
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$login = $_POST['login'];
$mail = $_POST['mail'];
$pass = $_POST['pass'];
$interets = $_POST['interets'];
$occupations = $_POST['occupations'];
$motivations = $_POST['motivations'];
$informations = $_POST['informations'];
$sql = "INSERT INTO inscriptions (id, nom, prenom, login, mail, pass, interets, occupations, motivations, informations) VALUES ('', '$nom', '$prenom', '$login', '$mail', '$pass', '$interets', '$occupations', '$motivations, '$informations')";
$ret = mysql_query ($sql);
if ($ret === false) {
echo 'SQL error (ligne '.__LINE__.') : '.mysql_error().'<br />with : '.$sql.'<br />';
}
mysql_close();
?>
Mais lorsque je rempli le formulaires, au moment de l'insertion dans la bdd une erreur apparaît :Notice: Undefined variable: motivation in /var/www/bob-web.fr/htdocs/radiatorust/inscription_confirmation.php on line 19
Warning: mysql_query() [http://www.mysql.com/doc]: 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 '', '')' at line 1 in /var/www/bob-web.fr/htdocs/radiatorust/inscription_confirmation.php on line 20
SQL error (ligne 23) : 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 '', '')' at line 1
with : INSERT INTO inscriptions (id, nom, prenom, login, mail, pass, interets, occupations, motivations, informations) VALUES ('', 'Bob', 'Bob', 'Bob, '[email protected]', '', 'programmation, web, informatique', 'création de sites web', ', '')
Je ne pas vois d'erreur, j'ai cherché une solution à la "version de MySql" du message d'erreur mais j'ai rien trouvé. J'ai déjà fait des codes de st