Bonjour,

J'ai créer un formulaire et j'ai tout vérifier ça marche mais il se pose un problème lors de l'insertion des informations dans la basse des données aucune information n'entre pourtant le formulaire est très bien vérifié. voici mes codes sources


Le formulaire de commande
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
 
<form action="chek_achat.php" method='post'  onSubmit="return(VerifForm(this))">
          <table width="280" border="0">
            <tr> 
              <td class="td">Nom *</td>
              <td >
                  <input type="text" name="nom"></td>
            </tr>
 
            <tr> 
              <td class="td">Prénom *</td>
              <td> <input type="text" name="prenom"></td>
            </tr>
 
            <tr> 
              <td class="td">Civilité</td>
             <td><select  name="sexe" class="input"> <option>Monsieur</option>
             <option>Mademoiselle</option>
             <option>Madame</option></td>
             </select>
            </tr>
 
            <tr> 
              <td class="td">Société *</td>
              <td> <input type="text" name="societe"></td>
            </tr>
 
            <tr> 
              <td class="td">E-mail *</td>
              <td><input type="text" name="mail"></td>
            </tr>
 
            <tr> 
              <td class="td">Accessoire *</td>
              <td>
			  <select  name="accessoire" class="input"  >
			  <option selected="selected">
               		<?php
					//et voiilà je balaye le tablo des pays d'afrique ici
				for($i=0;$i<sizeof($article['accessoire']); $i++){
				echo '<option value="'.$article['accessoire'][$i].'">'.$article['accessoire'][$i].'</option>';
					}
					?>
  </option>
                </select>
			  </td>
            </tr>
 
             <tr> 
              <td class="td">Marque *</td>
              <td>
			  <select  name="marque" class="input"  >
			  <option selected="selected">
               		<?php
					//et voiilà je balaye le tablo des pays d'afrique ici
				for($i=0;$i<sizeof($article['marque']); $i++){
				echo '<option value="'.$article['marque'][$i].'">'.$article['marque'][$i].'</option>';
					}
					?>
  </option>
                </select>
			  </td>
            </tr>
 
			<tr> 
              <td class="td">Ville *</td>
              <td>
			  <select  name="ville"  class="input"  >
			  <option  selected="selected">
               		<?php
					//et voiilà je balaye le tablo des pays d'afrique ici
				for($i=0;$i<sizeof($rdc['ville']); $i++){
				echo '<option value="'.$rdc['ville'][$i].'">'.$rdc['ville'][$i].'</option>';
					}
					?>
  </option>
                </select>
			  </td>
            </tr>
			<tr> 
              <td class="td">Téléphone *</td>
              <td><input type="text" name="phone"></td>
            </tr>
            <tr> 
             </tr>
 
			<tr> 
              <td class="td">Détail de votre commande</td>
              <td>
              <textarea name="detaille" id="message" rows="9" cols="25">
 
              </textarea>
              </td>
            </tr>
            <tr> 
 
              <td>&nbsp;</td>
              <td><input type="submit" name="Submit" value="Commander"></td>
            </tr>
          </table><p align="center"><a href="javascript:history.back(1);">Retour</a></p>
</form></p>


La vérification

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
<?php
include('config.php');
$nom= $_POST['nom'];
$prenom= $_POST['prenom'];
$societe= $_POST['societe'];
$mail= $_POST['mail'];
$sexe= $_POST['sexe'];
$accessoire= $_POST['accessoire'];
$marque= $_POST['marque'];
$ville= $_POST['ville'];
$phone= $_POST['phone'];
$detaille= $_POST['detaille'];
 
if($nom=="" || $prenom=="" || $societe=="" || $mail=="" || $sexe=="" || $accessoire=="" || $marque=="" || $ville=="" || $phone=="" || $detaille=="")
    {
    echo '<script language=javascript> alert ("Vous avez sans doute fait une erreur");</script>';
    echo '<SCRIPT LANGUAGE="JavaScript">
document.location.href="comnde.php" </SCRIPT>';
exit;
    }
$sql = "SELECT nom FROM tbl_commande WHERE nom='$_POST[nom]'";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
 
$data = mysql_fetch_array($req);
 
if($data['nom']==$nom)
        {
		echo '<script language=javascript> alert ("Vous avez deja passer une commande avec ce nom");</script>';
		echo '<SCRIPT LANGUAGE="JavaScript">
document.location.href="comnde.php"
</SCRIPT>';
exit;
        }
$sql = "SELECT mail FROM tbl_commande WHERE mail='$_POST[mail]'";
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
 
$data = mysql_fetch_array($req);
 
if($data['mail']==$mail)
        {
		echo '<script language=javascript> alert ("Vous avez sans doute fait une erreur.");</script>';
		echo '<SCRIPT LANGUAGE="JavaScript">
document.location.href="comnde.php"
</SCRIPT>';
exit;
}
else
{$requete=mysql_query("INSERT INTO tbl_commande VALUES('$_POST[nom]','$_POST[prenom]','$_POST[societe]','$_POST[mail]','$_POST[sexe]' ,'$_POST[ville]','$_POST[phone]','$_POST[accessoire],'$_POST[marque])");
echo '  <p>Votre commande a bien ete faite   Nous vous recontactons dans tres bientot <a href="index.php?page=accueil">Page d\'accueil</a> </p>';
	}
?>