Trasmission de donnees

Résolu
Nouvelle etape ...Nouveau probleme !

Des que je rajoute mon code javascript, mon formulaire ne se transmet plus a ma BBD.
Quelqu un coonnait il se Probleme ?
Avez vous une solution ?

2 réponses

  1. le problème c'est comment tu as ajouté le code, le js ne fait pas planter ton form pour ien, il doit y avoir des erreurs.
    Sans code, pas possible de savoir ou et quoi...
    0
    1. <!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" xml:lang="fr" lang="fr">

      <head>
      <title>Ced</title>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <script type="text/javascript">
      function check_form(){
      //verif du nom
      var nom=document.getElementById('nom');
      if(nom.value==""){
      alert("Vous devez remplir le champ Nom !");
      nom.focus(); //on donne le focus au champ nom
      return false; //ainsi le formulaire ne sera pas posté
      }
      //verif prenom
      var prenom=document.getElementById('prenom');
      if(prenom.value==""){
      alert("Vous devez remplir le champ Prénom !");
      prenom.focus(); //on donne le focus au champ prenom
      return false; //ainsi le formulaire ne sera pas posté
      }
      //verif dtn
      var dtn=document.getElementById('dtn');
      if(dtn.value==""){
      alert("Vous devez remplir le champ Date de naissance !");
      dtn.focus(); //on donne le focus au champ dtn
      return false; //ainsi le formulaire ne sera pas posté
      }
      //verif adresse
      var adresse=document.getElementById('adresse');
      if(adresse.value==""){
      alert("Vous devez remplir le champ Adresse !");
      adresse.focus(); //on donne le focus au champ adresse
      return false; //ainsi le formulaire ne sera pas posté
      }
      //verif complement
      var complement=document.getElementById('complement');
      if(complement.value==""){
      alert("Vous devez remplir le champ Complement d'adresse !");
      complement.focus(); //on donne le focus au champ complement
      return false; //ainsi le formulaire ne sera pas posté
      }
      //verif cp
      var cp=document.getElementById('cp');
      if(cp.value==""){
      alert("Vous devez remplir le champ Code postal !");
      cp.focus(); //on donne le focus au champ cp
      return false; //ainsi le formulaire ne sera pas posté
      }
      //verif ville
      var ville=document.getElementById('Ville');
      if(ville.value==""){
      alert("Vous devez remplir le champ Ville !");
      ville.focus(); //on donne le focus au champ ville
      return false; //ainsi le formulaire ne sera pas posté
      }
      //verif telephone
      var telephone=document.getElementById('telephone');
      if(telephone.value==""){
      alert("Vous devez remplir le champ Téléphone !");
      telephone.focus(); //on donne le focus au champ telephone
      return false; //ainsi le formulaire ne sera pas posté
      }
      //verif email
      var email=document.getElementById('email');
      if(email.value==""){
      alert("Vous devez remplir le champ email !");
      email.focus(); //on donne le focus au champ email
      return false; //ainsi le formulaire ne sera pas posté
      }
      //etc pour tous les champs a tester non vides

      //et a la fin de la fonction
      return true; //si on est arrivé la c'est que tout est ok donc on autorise l'envoi du formulaire
      }
      </script>
      </head>

      <body>

      <form name="form1" action="envoi_post.php" method="post" onSubmit="return check_form();">
      <!-- ci dessus il manquait le c à check_form -->
      <div align="center">
      <center>
      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; border-width: 0" bordercolor="#111111" width="1033" height="196" background="1.gif">
      <tr>
      <td width="340" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
      </td>
      <td width="304" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
      <table border="1" cellpadding="0" cellspacing="0" style="border-width:0; border-collapse: collapse" bordercolor="#111111" width="341" height="222">
      <tr>
      <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
      <font color="#FFFFFF">Nom : </font></td>
      <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
      <input type="text" name="nom" id="nom" size="20" /></td>
      </tr>
      <tr>
      <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
      <font color="#FFFFFF">Prénom : </font></td>
      <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
      <input type="text" name="prenom" id="prenom" size="20" /></td>
      </tr>
      <tr>
      <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
      <font color="#FFFFFF">Date de naissance : </font></td>
      <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
      <input type="text" name="dtn" id="dtn" size="20" /></td>
      </tr>
      <tr>
      <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
      <font color="#FFFFFF"><label for="adresse">Adresse</label> : </font>
      </td>
      <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
      <input type="text" name="adresse" id="complement0" size="20" /></td>
      </tr>
      <tr>
      <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
      <font color="#FFFFFF"><label for="adresse0">Complément d'adresse</label>
      : </font></td>
      <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
      <input type="text" name="complement" id="complement" size="20" /></td>
      </tr>
      <tr>
      <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
      <font color="#FFFFFF">Code postal : </font></td>
      <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
      <input type="text" name="cp" id="cp" size="20" /></td>
      </tr>
      <tr>
      <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
      <font color="#FFFFFF">Ville : </font></td>
      <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
      <input type="text" name="ville" id="ville" size="20" /></td>
      </tr>
      <tr>
      <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
      <font color="#FFFFFF">Téléphone : </font></td>
      <td width="170" height="39" align="center" style="border-style: none; border-width: medium">
      <input type="text" name="telephone" id="telephone" size="20" /></td>
      </tr>
      <tr>
      <td width="169" height="39" align="left" style="border-style: none; border-width: medium">
      <font color="#FFFFFF">Email : </font></td>
      <td width="170" height="39" align="center" style="border-left-style: none; border-left-width: medium; border-right-style: none; border-right-width: medium; border-top-style: none; border-top-width: medium; border-bottom: medium none #111111">
      <input type="text" name="email" id="email" size="20" /></td>
      </tr>
      </table>
      <p align="center"><input type="submit" name="envoyer" value="Envoyer"> </p>
      </td>
      <td width="349" height="196" valign="middle" style="border-style: none; border-width: medium" align="center">
      </td>
      </tr>
      </table>
      </center>
      </div>
      </center>
      </form>

      </body>

      </html>
      0