Partage
  • Partager sur Facebook
  • Partager sur Twitter

Erreur de syntaxe ?

    15 janvier 2018 à 18:39:17

    Hello !


    Je suis en étude pour devenir Développeur web, et actuellement je dois rendre un devoir sur les formualire de contact, on ma demander de copier un script PHP et de l'insérer dans un de mes sites. 

    chose que j'ai faite mais lorsque je reçois le mail il est vide, et franchement ça fait 5 fois que je relis et que  je recopie caractère pour caractère le script demander, je ne trouve pas d'où ça vient^^ 

    alors si une âme charitable avait une idée... je suis preneur !  mon script est : 

    <?php

    $adresse= "exemple@gmail.com";

    $TO= $adresse;

    $head= "From:".$adresse."\n";

    $head.= "X-Sender:<".$adresse.">\n";

    $head.= "X-Mailer: PHP\n";

    $head.= "Return-Path:<".$adresse.">\n";

    $head.= "Content-Type: texte/plain; charset=iso-8859-1\n";

    $sujet= "Formulaire Formation DREAMWEAVER CC";

    $informations= "

    Civilité: ".$_POST['Civilité']."\r\n

    Nom: ".$_POST['Nom']."\r\n

    Prénom: ".$_POST['Prenom']."\r\n

    Sports: ".$_POST['Sport']."\r\n

    Niveau: ".$_POST['Niveau-sport']."\r\n

    Email du formulaire: ".$_POST['email']."\r\n

    Message: ".$_POST['Message']."\r\n

    ";

    $res= mail($TO, $sujet, $informations, $head);

    Header("Location: http://www.exemple.com/formulaire.html");

    ?>




    Merci 

    -
    Edité par AllanLatruffe 3 août 2018 à 17:02:11

    • Partager sur Facebook
    • Partager sur Twitter



         
    Allan Latruffe      
    ALLAN LATRUFFE
    Webmaster - Developper Web
    Tel : 06.31.35.27.81
    Mail :allan.latruffe@gmail.com
      15 janvier 2018 à 19:24:19

      Salut,

      Tu peux mettre ton code dans les balises </> et nous poster le fichier HTML de ton formulaire avec ?

      $adresse= "allan.latruffe@gmail.com";
      
      $TO= $adresse;
      
      $head= "From:".$adresse."\n";
      
      $head.= "X-Sender:<".$adresse.">\n";
      
      $head.= "X-Mailer: PHP\n";
      
      $head.= "Return-Path:<".$adresse.">\n";
      
      $head.= "Content-Type: texte/plain; charset=iso-8859-1\n";
      
      $sujet= "Formulaire Formation DREAMWEAVER CC";
      
      $informations= "
      
      Civilité: ".$_POST['Civilité']."\r\n
      
      Nom: ".$_POST['Nom']."\r\n
      
      Prénom: ".$_POST['Prenom']."\r\n
      
      Sports: ".$_POST['Sport']."\r\n
      
      Niveau: ".$_POST['Niveau-sport']."\r\n
      
      Email du formulaire: ".$_POST['email']."\r\n
      
      Message: ".$_POST['Message']."\r\n
      
      ";
      
      $res= mail($TO, $sujet, $informations, $head);
      
      Header("Location: http://www.stephanelatruffe.com/formulaire.html");



      • Partager sur Facebook
      • Partager sur Twitter
        15 janvier 2018 à 20:02:06


        Oui , le formulaire est dans ce fichier (formulaire.html) ligne 228 : 

        <!doctype html>
        <html>
        <head>
        <meta charset="utf-8">
        <title>Toketa - L'équipe</title>
        <style type="text/css">
        	/*code du formulaire*/
        h3 {
        	text-transform: none;
        	text-align: center;
        }
        p {
        	font-weight: bolder;
        }
        select {
        	background-color: #DDD058;
        }
        .case {
        	width: 75px;
        	font-weight: normal;
        	background-color: #E89798;
        }
        .td-center {
        	padding-left: 0px;
        	text-align: center;
        }
        table {
        	margin-left: auto;
        	margin-right: auto;
        	border: 2px solid #000000;
        	background-color: #DFC5C5;
        }
        td {
        	padding-left: 10px;
        	border-width: 0px;
        }
        /*Code du thème*/
        body {
        	background-color: #FFFFFF;
        }
        main {
        	background-color: #EC6B6D;
        	width: 900px;
        	margin-right: auto;
        	margin-left: auto;
        	padding-top: 10px;
        	padding-right: 10px;
        	padding-bottom: 10px;
        	padding-left: 10px;
        }
        
        header {
        	background-color: #F4D465;
        	padding-top: 10px;
        	padding-right: 10px;
        	padding-bottom: 10px;
        	padding-left: 10px;
        	margin-top: 10px;
        }
        nav {
        	background-color: #BDF74B;
        	padding-top: 10px;
        	padding-right: 10px;
        	padding-bottom: 10px;
        	padding-left: 10px;
        	margin-top: 10px;
        	margin-bottom: 10px;
        	display: block;
        }
        section {
        	background-color: #54EF8C;
        	padding-top: 10px;
        	padding-right: 10px;
        	padding-bottom: 10px;
        	padding-left: 10px;
        	margin-top: 10px;
        	margin-bottom: 10px;
        	width: 600px;
        	float: left;
        }
        aside {
        	background-color: #7D3DF1;
        	padding-top: 10px;
        	padding-right: 10px;
        	padding-bottom: 10px;
        	padding-left: 10px;
        	margin-top: 10px;
        	margin-bottom: 10px;
        	width: 245px;
        	float: right;
        }
        article {
        	background-color: #67ADF7;
        	padding-top: 10px;
        	padding-right: 10px;
        	padding-bottom: 10px;
        	padding-left: 10px;
        }
        footer {
        	background-color: #F86ECC;
        	padding-top: 10px;
        	padding-right: 10px;
        	padding-bottom: 10px;
        	padding-left: 10px;
        	margin-top: 10px;
        	margin-bottom: 10px;
        	clear: left;
        	height: auto;
        	width: auto;
        }
        .img-logo {
        	width: 80px;
        	height: auto;
        	float: left;
        }
        .h1-header {
        	display: table-cell;
        	padding-left: 20px;
        	-webkit-transition: color 1s ease-in-out 0s, visibility 1s ease-in-out 1s;
        	-o-transition: color 1s ease-in-out 0s, visibility 1s ease-in-out 1s;
        	transition: color 1s ease-in-out 0s, visibility 1s ease-in-out 1s;
        }
        .main-nav-ul   {
        	list-style-type: none;
        }
        .nav-ul-li {
        	display: inline-block;
        	margin-right: 15px;
        }
        .main-nav-img   {
        	width: 30px;
        	height: auto;
        	margin-right: 15px;
        	display: inline;
        	float: left;
        }
        .article1 {
        	margin-bottom: 10px;
        }
        .article1 img {
        	width: 200px;
        	height: auto;
        	margin-left: 10px;
        	margin-right: 10px;
        	-webkit-transition: width 1s ease-in 0s;
        	-o-transition: width 1s ease-in 0s;
        	transition: width 1s ease-in 0s;
        	float: left;
        }
        .article2 p  {
        }
        .aside-video {
        	width: 225px;
        	height: auto;
        	margin-left: 10px;
        }
        .article1 p {
        	margin-top: 0px;
        	text-align: justify;
        	-webkit-transition: font-size 1s linear 0s, color 1s ease-in 1s;
        	-o-transition: font-size 1s linear 0s, color 1s ease-in 1s;
        	transition: font-size 1s linear 0s, color 1s ease-in 1s;
        }
        .article2p {
        	text-align: justify;
        }
        main footer p {
        	/* [disabled]border-left-color: #000000; */
        	/* [disabled]border-right-color: #000000; */
        	/* [disabled]border-bottom-color: #000000; */
        	border-top: 2px solid #000000;
        	/* [disabled]border-left-style: solid; */
        	/* [disabled]border-right-style: solid; */
        	/* [disabled]border-bottom-style: solid; */
        	/* [disabled]border-left-width: 2px; */
        	/* [disabled]border-right-width: 2px; */
        	/* [disabled]border-bottom-width: 2px; */
        	margin-top: 0px;
        	margin-right: 0px;
        	margin-bottom: 0px;
        	margin-left: 0px;
        }
        .article1 p:hover {
        	font-size: 20px;
        	color: #FF0000;
        }
        .article1 img:hover {
        	width: 50%;
        }
        .h1-header:active {
        	color: #FF0000;
        	visibility: hidden;
        }
        #Cadre-droit {
        }
        </style>
        <link href="css/CSS-CNFDI.css" rel="stylesheet" type="text/css">
        <script type="text/javascript">
        function MM_showHideLayers() { //v9.0
          var i,p,v,obj,args=MM_showHideLayers.arguments;
          for (i=0; i<(args.length-2); i+=3) 
          with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
            if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
            obj.visibility=v; }
        }
        function MM_popupMsg(msg) { //v1.0
          alert(msg);
        }
        </script>
        </head>
        
        <body>
        <main>
          	<header> <a href="http://www.cnfdi.com" target="_blank"><img src="image/Toketa-communication.jpg" alt="Toketa-communication" width="450" height="202" class="img-logo"/></a>
          	  <h1 class="h1-header">Toketa Communication</h1>
          	</header>
          	<nav id="menu"> <a href="index.html"><img src="image/accueil.png" alt="accueil" class="main-nav-img"/></a>
        	<ul class="main-nav-ul">
          	    <li class="nav-ul-li"><a href="index.html">L'équipe</a></li>
          	    <li class="nav-ul-li"><a href="Print.html">Print</a></li>
          	    <li class="nav-ul-li"><a href="Web.html">Web</a></li>
          	    <li class="nav-ul-li"><a href="mailto:contact@cnfdi.com ?body=Je souhaite recevoir plus d'informations&subject=Demande d'informations">Contact</a></li>
        		<li class="nav-ul-li page-en-cours">Formulaire</li>
              </ul>
          	</nav>
          <section>
            	<h3>Remplissez le formulaire suivant</h3>
        <form action="validation.php" method="post" name="FORM-CNFDI" id="FORM-CNFDI">
          <table width="500" border="1">
            <tbody>
              <tr>
                <td><p>Civilité: </p></td>
                <td><p>
                  <label>
                    <input type="radio" name="Civilit&eacute;" value="Mr" id="Civiliteacute_0">
                    Mr</label>
                  <br>
                  <label>
                    <input type="radio" name="Civilit&eacute;" value="Mme" id="Civiliteacute_1">
                    Mme</label>
                  <br>
                </p></td>
              </tr>
              <tr>
                <td><p>Nom:</p></td>
                <td><input name="Nom" type="text" required="required" id="Nom" placeholder="Entrez votre nom"></td>
              </tr>
              <tr>
                <td><p>Prénom:</p></td>
                <td><input name="Prenom" type="text" required="required" id="Prenom" placeholder="Entrez votre prénom"></td>
              </tr>
              <tr>
                <td><p>Sport souhaité:</p></td>
                <td><p>
                  <label>
                    <input type="checkbox" name="Sport" value="Tennis" id="Choixdusport_0">
                    Tennis</label>
                  <br>
                  <label>
                    <input type="checkbox" name="Sport" value="Foot" id="Choixdusport_1">
                    Foot</label>
                  <br>
                  <label>
                    <input type="checkbox" name="Sport" value="Rugby" id="Choixdusport_2">
                    Rugby</label>
                  <br>
                  <label>
                    <input type="checkbox" name="Sport" value="Judo" id="Choixdusport_3">
                    Judo</label>
                  <br>
                </p></td>
              </tr>
              <tr>
                <td><p>Niveau:</p></td>
                <td><label for="Niveau-sport">Select:</label>
                  <select name="Niveau-sport" id="Niveau-sport">
                    <option value="Confirmé">Confirmé</option>
                    <option value="Débutant">Débutant</option>
                    <option value="Proféssionnel">Professionnel</option>
                </select></td>
              </tr>
              <tr>
                <td><p>Adresse email:</p></td>
                <td><input type="email" name="email" id="email"></td>
              </tr>
              <tr>
                <td><p>Message:</p></td>
                <td><textarea name="Message" rows="5" id="Message"></textarea></td>
              </tr>
              <tr>
                <td colspan="2"><input type="submit" name="submit" id="submit" value="Envoyer">
                <input type="reset" name="reset" id="reset" value="Réinitialiser"></td>
              </tr>
            </tbody>
          </table>
        </form>
          </section>
          <aside id="Cadre-droit" onClick="MM_showHideLayers('Cadre-droit','','hide')">
            <h3>Voici quelques liens… </h3>
            <ul>
              <li>
                Questions/réponses </li>
              <li>Espace entreprises </li>
              <li>Que sont-ils devenus ?</li>
              <li> Plans </li>
              <li>Contact </li>
            </ul>
            <h3>… et une vidéo</h3>
            <video width="200" class="aside-video" title="Video Kinomichi" controls="controls" muted="muted" autoplay="autoplay" loop="loop" >
              <source src="video/videoaside.mp4" type="video/mp4">
              <p>Video maitre Noro</p>
            </video>
          </aside>
          <footer><p style="text-align: center">Mention Légales<br>
              Tous droit reserver Copyright 2017-2018<br>
              <br>
             </p>
          </footer>
        </main>
        </body>
        </html>
        

        Et il fait référence au fichier validation.php  : 

        <?php
        
        $adresse= "allan.latruffe@gmail.com";
        
        $to="$adresse";
        
        $head= "From:".$adresse."\n";
        $head.= "X-Sender:<".$adresse.">\n";
        $head.= "X-Mailer: PHP\n";
        $head.= "Return-Path:<".$adresse.">\n";
        $head.= "Content-Type: texte/plain; charset=iso-8859-1\n";
        
        $sujet= "Formulaire Formation DREAMWEAVER CC";
        
        $informations= "
        Civilité: ".$_POST['Civilité']."\r\n
        Nom: ".$_POST['Nom']."\r\n
        Prénom: ".$_POST['Prenom']."\r\n
        Sports: ".$_POST['Sport']."\r\n
        Niveau: ".$_POST['Niveau-sport']."\r\n
        Email du formulaire: ".$_POST['email']."\r\n
        Message: ".$_POST['Message']."\r\n
        ";
        
        $res= mail($to, $sujet, $informations, $head);
        
        Header("Location: http://www.example.com/formulaire.html");
        
        ?>







        -
        Edité par AllanLatruffe 3 août 2018 à 17:01:42

        • Partager sur Facebook
        • Partager sur Twitter



             
        Allan Latruffe      
        ALLAN LATRUFFE
        Webmaster - Developper Web
        Tel : 06.31.35.27.81
        Mail :allan.latruffe@gmail.com
          15 janvier 2018 à 21:59:42

          Bonjour,

          Tu devrais commencer par éliminer les caractères accentués dans tes inputs (surtout que tu les "traduis" en html).

          • Partager sur Facebook
          • Partager sur Twitter
            18 janvier 2018 à 1:21:38

            Hey avec tout vos conseils j'ai finalement trouvé d'où venais réellement le problème, j'avais écrit texte/plain au lieu de text/plain , comme quoi une lette peut-être décisive !

            Merci pour votre aide ! :) 

            • Partager sur Facebook
            • Partager sur Twitter



                 
            Allan Latruffe      
            ALLAN LATRUFFE
            Webmaster - Developper Web
            Tel : 06.31.35.27.81
            Mail :allan.latruffe@gmail.com

            Erreur de syntaxe ?

            × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
            × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
            • Editeur
            • Markdown