Bonjour.

J'ai écrit (plutôt modifié) un script d'envoi de formulaire de contact avec antispam.
Il fonctionne très bien avec IE, Safari, GoogleChrome. Mais avec Firefox, les messages d'erreur apparaissent les un à la suite des autres en haut de page. Je donne le code. Si quelqu'un peut m'aider à résoudre le problème !

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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
	<?php
 
if(isset($_POST['email']) and isset($_POST['sujet']) and isset($_POST['message']))
{
 
        $destinataire = 'toto.bernie@gmail.com';
        $email = htmlspecialchars($_POST['email']);
		$val1=rand(1, 10);
					$val2=rand(1, 10);
					$verifresult=$val1*$val2;
 
		if ($_POST['email'] !="")
{
if ($_POST['sujet'] !="")
{
 
if ($_POST['message'] !="")
{
 if ($_POST['verification']==$_POST['verifresult'])
 {
 
        if(preg_match('#^(([a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+\.?)*[a-z0-9!\#$%&\\\'*+/=?^_`{|}~-]+)@(([a-z0-9-_]+\.?)*[a-z0-9-_]+)\.[a-z]{2,}$#i',str_replace('&amp;','&',$email)))
        {
 
                $sujet = 'Les amis de Llyon: '.stripslashes($_POST['sujet']);
                $message = stripslashes($_POST['message']);
                $headers = "From: <".$email.">\n";
                $headers .= "Reply-To: ".$email."\n";
                $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"";
                if(mail($destinataire,$sujet,$message,$headers))
 
                {
                 echo '<center>
                             <br>
                             <table border="1" width="300px">
                             <tbody>
                               <tr>
                                <td style="text-align: center; background-color: #000099;"><span style="color: white;">
                                             <b>Votre message a bien &eacute;t&eacute; envoy&eacute;.</b></span></td>
                               </tr>
                             </tbody>
                             </table>
                       </center>';
                }
                else
                {
                        echo
                          '<center>
                             <br>
                             <table border="1" width="300px">
                             <tbody>
                               <tr>
                                <td style="text-align: center; background-color: #ff0000;"><span style="color: white;">
                                       <b>Une erreur s\'est produite lors de l\'envois du message.</b></span></td>
                               </tr>
                             </tbody>
                             </table>
                       </center>';
 
                }
        }
        else
        {
                echo
                  '<center>
                          <br>
                             <table border="1" width="300px">
                             <tbody>
                               <tr>
                                <td style="text-align: center; background-color: #ff0000;"><span style="color: white;">
                                       <b>L\'email que vous avez entr&eacute; est invalide.</b></span></td>
                               </tr>
                             </tbody>
                             </table>
                       </center>';
 
    }
 
}
 
else
{
echo
   '<center>
          <br>
           <table border="1" width="300px">
           <tbody>
           <tr>
           <td style="text-align: center; background-color: #ff6600;"><span style="color: white;">
                    <b>Le résultat de la multiplication est faux, merci de réessayer !</b></span></td>
           </tr>
           </tbody>
           </table>
    </center>';
 
 
 
}
}
else
{
echo
   '<center>
          <br>
           <table border="1" width="300px">
           <tbody>
           <tr>
           <td style="text-align: center; background-color: #ff0000;"><span style="color: white;">
                    <b>Veuillez remplir votre message!</b></span></td>
           </tr>
           </tbody>
           </table>
    </center>';
 
 
}
}
else
{
echo
   '<center>
          <br>
           <table border="1" width="300px">
           <tbody>
           <tr>
           <td style="text-align: center; background-color: #ff0000;"><span style="color: white;">
                    <b>Veuillez remplir votre sujet de contact</b></span></td>
           </tr>
           </tbody>
           </table>
    </center>';
 
 
}
}
else
 
{ 
echo
    '<center>
           <br>
           <table border="1" width="300px">
           <tbody>
           <tr>
           <td style="text-align: center; background-color: #00ff00;"><span style="color: white;">
                    <b>Veuillez remplir l\'adresse email !</b></span></td>
           </tr>
           </tbody>
           </table>
    </center>';
 
 
}
 
}
 
 
 
?>
     <body style="                   background-color: #ffffcf;">
      <form action="" method="post">
      <center>
 
        <p><span style="color: #cc0000;"><font size ="6"><b> Les amis de l'Eglise saint Nizier</b></font></span></p>
        <P><span style="color: #0000ff;"><font size ="5">Contact</p></font></span></p>
 
       <br>
      <center>
      <table border="1" width="280px">
        <tbody>
          <tr>
            <td style="text-align: center; background-color: #ffff66;">Attention : Tous les
              champs sont requis.</td>
          </tr>
        </tbody>
      </table>
    </center>
 
 
        <label for="email">Votre adresse email :</label> <input type="text" name="email" id="email" /><p>
        <label for="sujet" >Vos noms-prénoms :</label> <input type="text" name="sujet" id="sujet" /><p>
        <label for="message">Votre message :</label><br><textarea cols="50" rows="8" name="message" id="message"></textarea>
        <p>
		<label for="verification">Vérification anti spam :</label><?php
					$val1=rand(1, 10);
					$val2=rand(1, 10);
					$verifresult=$val1*$val2;
					?>
					<input type="text" name="verification" placeholder="<?php echo "$val1 x $val2 = "; ?>" /><input type="hidden" name="verifresult" value="<?php echo $verifresult; ?>" /><p><br />
 
 
 
      <input type="submit" class="bnt-connect" value="Envoyer" />
     </center>
     </form>
        <p style="background-color: #ffffcc;" align="center">&nbsp;<img alt="co" src="courriel.jpg"></p>
    <center style="background-color: #ffffcc;">
      <table style="width: 600px; height: 87px;" border="0">
        <tbody>
          <tr>
            <td style="text-align: right; width: 200px"><img alt="fl" src="fleche_298.gif"><br>
            </td>
            <td style="width: 400px;"><a href="bon%201.pdf">Bon dinformation au
                format PDF</a><br>
              <a href="bon%201.doc">Bon d'information au format DOC 95 - 2003</a><br>
              <a href="bon%201.rtf">Bon d'information au format RTF</a><br>
            </td>
          </tr>
        </tbody>
      </table>
    </center>
 
       <center>
       <table border="1" width="100px">
      <tbody>
        <tr>
          <td style="background-color: red;text-align: center;"><A href="javascript:window.close();"style="text-decoration : none"><font color=#990000"><b><span style="color: white;">QUITTER</span></b></font></A>
          </td>
        </tr>
      </tbody>
      </table>
      </center>
 
 
        </p>
     <br /><br />
    </body>