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
43
44
45
46
47
48
<?php
if (isset($_POST['nom']) AND isset($_POST['prenom']) AND isset($_POST['mail']) AND isset($_POST['numtel']) AND isset($_POST['cout']))
{ 
if ($_POST['nom'] != NULL)
{
if ($_POST['prenom'] != NULL)
{
if ($_POST['mail'] != NULL OR $_POST['numtel'] != NULL)
{
 
 
		  // D'abord, on se connecte à MySQL
          mysql_connect("localhost", "guismoman33", "061088");
          mysql_select_db("guismoman33");
		  // On utilise les fonctions PHP mysql_real_escape_string et htmlspecialchars pour la sécurité
		  $nom = mysql_real_escape_string(htmlspecialchars($_POST['nom']));
		  $prenom = mysql_real_escape_string(htmlspecialchars($_POST['prenom']));
		  $numtel = mysql_real_escape_string(htmlspecialchars($_POST['numtel']));
		  $mail = mysql_real_escape_string(htmlspecialchars($_POST['mail']));
		  $type = mysql_real_escape_string(htmlspecialchars($_POST['type']));
		  $piece = mysql_real_escape_string(htmlspecialchars($_POST['piece']));
		  $cout = mysql_real_escape_string(htmlspecialchars($_POST['cout']));
		  $charge = mysql_real_escape_string(htmlspecialchars($_POST['charge']));
		  $garantie = mysql_real_escape_string(htmlspecialchars($_POST['garantie']));
		  $quartier = mysql_real_escape_string(htmlspecialchars($_POST['quartier']));        
		  $description = mysql_real_escape_string(htmlspecialchars($_POST['description'])); 
			// Ensuite on enregistre le message
			mysql_query("INSERT INTO annonce VALUES('', '$nom', '$prenom', '$numtel', '$mail', '$type', '$piece', '$cout', '$charge', '$garantie', '$quartier', '$description', 'non')");
 
			// On se déconnecte de MySQL
		    mysql_close();	
}
else
{
echo ('Aucun renseignement pour vous joindre...');
}
}
else
{ 
echo ('Vous navez pas mis votre prénom');
}
}
else 
{
echo ('Vous navez pas mis votre nom de famille');
}
}
?>
VOici mon code y a t il une erreur dedans?
Voici maintenant mon formulaire!!!
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
	<form action="index.php?page=conf" method="post">
	<p>
	Nom : <input type="text" name="nom" /><br>
	Prénom : <input type="text" name="prenom" /><br>
	Numéro de téléphone : <input type="text" name="numtel" /> <br>
	Adresse E mail : <input type="text" name="mail" /><br>
 
	Type de bien : <br>
	<select name="type">
		<option value="maison" /> Maison </option>
		<option value="appartement" /> Appartement</option>
		<option value="demeure" /> Demeure de Prestige</option>
		<option value="loft" /> Loft</option>
		<option value="garage" /> Garage</option>
		<option value="terrain" /> Terrain</option>
		<option value="fonddecommerce" /> Fond de commerce</option>
		<option value="immeuble" /> Immeuble</option>
		<option value="bureaupro" /> Bureau ou local professionel</option>
		<option value="agri" /> Domaine agricole</option>
		<option value="forest" /> Domaine forestier</option>
	</select>
	<br>Nombre de pièce : <br>
		<select name="piece">
			<option value="1">1</option>
			<option value="2">2</option>
			<option value="3">3</option>
			<option value="4">4</option>
			<option value="5">5</option>
			<option value="6">6 ou +</option>
		</select>
	Coût mensuel : <input type="text" name="cout" /><br>
	Charge : <input type="text" name="charge" /><br>
	Garantie : <input type="text" name="garantie" /><br>
	Quartier du bien : <input type="text" name="quartier" /><br>
    Description : <br>
		<textarea name="description" rows="8" cols="45">
			Votre desciption ici.
		</textarea>
	<br>
	<input type="submit" value="Valider" />
	</p>
	</form>
Je ne trouve pas l'erreur...Rien ne s'enregistre dans ma base...