bonjour a tous, j'ai un problème qui concerne un formulaire.
lorsque je saisie tous les champs de formulaire et je clique sur le bouton 'submit' il affiche l'erreur 2 fois " il faut remplir tous les champs "
j'en sais ou se trouve le problème dans le 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
$erreur='';
if(isset($_POST['submit']))
{
   if(!empty($_POST['nom']) && !empty($_POST['prenom']) && !empty($_POST['CIN']) && !empty($_POST['tel']) && !empty($_POST['etatcivil']) && 
    !empty($_POST['dateN']) && !empty($_POST['sexe']) && !empty($_POST['situation']) && !empty($_POST['nbreenfants']) && !empty($_POST['adresse']) &&  !empty($_POST['ville']) && !empty($_POST['email']))
	 {
	 $nom=htmlspecialchars(trim($_POST['nom']));
	  $prenom=htmlspecialchars(trim($_POST['prenom']));
	   $CIN=htmlspecialchars(trim($_POST['CIN']));
	   $tel=htmlspecialchars(trim($_POST['tel']));
	   $etatcivil=htmlspecialchars(trim($_POST['etatcivil']));
	   $dateN=htmlspecialchars(trim($_POST['dateN']));
	   $sexe=$_POST['sexe'];
	    $situation=$_POST['situation'];
		 $nbreenfants=htmlspecialchars(trim($_POST['nbreenfants']));
		 $adresse=htmlspecialchars(trim($_POST['adresse']));
		  $ville=$_POST['ville'];
		  $email=htmlspecialchars(trim($_POST['email']));
 
		  $connect=mysql_connect('localhost','root','') or die ('erreur de connection en mysql'); 
		  mysql_select_db('GRH');
 
		  $request=mysql_query("INSERT INTO employees(nom,prenom,CIN,tel,etatcivil,dateN,sexe,situation,nbreenfants,adresse,ville,email)
		  VALUES('$nom','$prenom','$CIN','$tel','$etatcivil','$dateN','$sexe','$situation','$nbreenfants','$adresse','$ville','$email')")  
		  or die (mysql_error());
 
		  die('Votre profil est bien  enregistré');
 
		  mysql_close($connect);
 
	 } else { echo $erreur="<b> <font color='red' size='3'>il faut remplir tous les champs!</font> </b>";}
} 
?>
<html>
<head>
<title>Profil</title>
<link rel="shortcut icon" href="css/images/favicon.ico" />
<link href="css/template_style.css" type="text/css" rel="stylesheet" />     
 
</head> 
 
 
<body> 
<p id="erreur"><?php if(isset($erreur) !='') echo $erreur;?>
<div id="templatemo_header_wrapper">
	<div id="templatemo_header">
    	<div id="logo"><a href="index.html" ></a></div>
        <p id="intro_text">Suspendisse at justo in felis ultricies cursus. Quisque risus sed lacus pharetra sit amet pretium lacus aliquet. Sed commodo tellus dictum et lacinia sem.</p>
        <a class="intro_bg_by" href="index.html" title="images"  target="_blank"><img src="images/templatemo_background.png" alt="images" /></a>    </div>
</div>
<div id="templatemo_main_wrapper">
	<div id="templatemo_main">
		<div id="content"> 
            <div id="home" class="section">
			 <a href="login.php" class="close">close</a><a href="index.html" class="home_btn">home</a>
			<center>
			<fieldset><legend align="center" ><font size="+1" color="#000000" face="Times New Roman, Times, serif">Remplir / Modifier Votre PV</font> </legend>
  <table cellpadding="1">
<form name="form" method="post" action="">
<div id="texts">
<td>nom: </td><td><input type="text" name="nom"/></td>
</tr>
<tr>
<td>Prenom:</td> <td><input type="text" name="prenom" /></td>
</tr>
<tr>
<td>CIN:</td> <td><input type="text" name="CIN" /></td>
</tr>
<tr>
<td>N° tel:</td> <td><input type="text" name="tel" /></td>
</tr>
<tr>
<td>Etat Civil:</td> <td><input type="text" name="etatcivil" /></td>
</tr>
<tr>
<td>
date Naissance:</td> <td><input type="text" size="1"name="dateN" maxlength="2"/> <input type="text" size="1" maxlength="2" name="date" /> <input type="text" size="4" maxlength="4" name="date"/></td>
</tr>
<tr>
<td> sexe:</td> <td>homme<input type="radio" name="sexe" /> femme<input type="radio"  name="sexe" />  </td>
</tr>
<td>Situation:</td><td><select name="situation">
<option></option>
<option>marié</option>
<option>En couple</option>
<option>veuf</option>
<option>celibataire</option>
<option> divorcé</option>
<option>fiancé</option>
<option>séparé</option>
</select>
<tr>
<td>Nombre D'Enfants:</td> <td><input type="text" name="nbreenfants" /></td>
</tr>
<tr>
<tr>
<td> Adresse:</td> <td><textarea rows="5" cols="20" name="adresse"></textarea></td>
</tr>
<tr>
<td>ville:</td><td><select name="ville">
<option></option>
<option>nabeul</option>
<option>sousse</option>
<option>tunis</option>
<option>bizerte</option>
<option>jandouba</option>
<option>mounastir</option>
</select>
 </td>
</tr>
<tr>
<td> E-mail:</td> <td><input type="text"  name="email" onFocus="if(this.value=='exemples@gmail.com'){this.value=''}"  onblur="if(this.value==''){ (this.value='exemples@gmail.com')}"  value="exemples@gmail.com"/></b></td></div>
</tr> <td></td>
<tr>
</tr> 
<tr><td></td>
</tr> <td></td>
<tr>
<td><center> <input type="submit" value="envoyer" name="submit" class="btn"/></center></td><td> <center><input type="reset" name="annuler" value="annuler"/></center></td>
</tr>
</form>
</table>
</fieldset>
 </center>           
 
            </div> 
        </div> 
    </div>
</div>
 
 
<div id="templatemo_footer_wrapper">
	<div id="templatemo_footer">
 
    </div>
</div>
 
</body>
</html>

Merci