IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

formulaire et fonction mail()


Sujet :

Langage PHP

  1. #1
    Nouveau membre du Club
    Inscrit en
    Septembre 2006
    Messages
    49
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 49
    Points : 30
    Points
    30
    Par défaut formulaire et fonction mail()
    formulaire & fonction mail()

    Bonjour,
    je suis entrin de faire un formuliare pour envoi de mail mais ca m'affiche cette erreur:

    Notice: Undefined index: nom in c:program fileseasyphp1-8wwwtogodumevisend_mail.php on line 2

    Notice: Undefined index: prenom in c:program fileseasyphp1-8wwwtogodumevisend_mail.php on line 3

    Notice: Undefined index: town in c:program fileseasyphp1-8wwwtogodumevisend_mail.php on line 4

    Notice: Undefined index: phone in c:program fileseasyphp1-8wwwtogodumevisend_mail.php on line 5

    Notice: Undefined index: mail in c:program fileseasyphp1-8wwwtogodumevisend_mail.php on line 6

    Notice: Undefined index: reponse in c:program fileseasyphp1-8wwwtogodumevisend_mail.php on line 7

    voici mon code php

    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
     
    <?php
    $nom = $_POST['nom'];
    $prenom = $_POST['prenom'];
    $town = $_POST['town'];
    $phone = $_POST['phone'];
    $mail=$_POST['mail'];
    $reponse = $_POST['reponse'];
    $adr = "jeu_wu@togodumevi.com";
    $obj = "Jeu";
    //Le message qui vous est envoyé
    $reponse_envoye =
    'nom : ' . $nom ."rn".
    'prenom :' . $prenom . "rn".
    'phone : ' . $phone ."rn" .
    'mail : ' . $mail ."rn" .
    'reponse : ' . $reponse ."rn" .
    mail($adr, $obj, $reponse_envoye );
    ?>
    voici mon formulaire:

    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
     
    <form action="send_mail.php"  method="post" name="contactform" id="contactform" enctype="text/plain">
                              <table cellspacing="2">
                                <tbody>
                                <tr> 
                                  <td align="right" nowrap="nowrap"> <strong>Nom: *</strong></td>
     
                                  <td> 
                                    <input name="nom" class="input-textfield-contactform" id="name" type="text">
                                  </td>
                                </tr>
                                <tr> 
                                  <td align="right" nowrap="nowrap"> <strong>Prénom: *</strong></td>
                                  <td> 
                                    <input  name="prenom" class="input-textfield-contactform" id="prenom" type="text">
                                  </td>
                                </tr>
     
    							<tr> 
                                  <td align="right" nowrap="nowrap"> <strong>Ville: *</strong></td>
                                  <td> 
                                    <input name="town" class="input-textfield-contactform" id="town" type="text">
                                  </td>
                                </tr>
     
                                <tr> 
                                  <td align="right" nowrap="nowrap"> <strong>Téléphone: *</strong></td>
                                  <td> 
                                    <input name="phone" class="input-textfield-contactform" id="phone" value="" type="text">
                                  </td>
                                </tr>
    							<tr> 
                                  <td align="right" nowrap="nowrap"> <strong>Mail: *</strong></td>
                                  <td> 
                                    <input name="mail" class="input-textfield-contactform" id="mail" value="" type="text">
                                  </td>
                                </tr>
                               <tr valign="top">
    						     <td>
    							 <br><b>vos réponses :</b> *</td>
      <td><textarea name="reponse" cols="25" rows="5" class="textarea-textfield-contactform" id="reponse">
      1-
     
      2-
     
      3-
      </textarea>
    					  </td>
    							 </tr>
    							    <tr valign="top">
    								  <td>
    								  <input value="envoyer"  onClick="javascript:if (testcontactform()) { document.contactform.submit(); }" type="button"/>
    								  </td>
    								 </tr>
     
        </tbody></table>
      </form>

    j'ai besoin de votre aide, merci

  2. #2
    Membre habitué
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    382
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France, Nord (Nord Pas de Calais)

    Informations forums :
    Inscription : Mai 2006
    Messages : 382
    Points : 151
    Points
    151
    Développeur LotusScript

  3. #3
    Nouveau membre du Club
    Inscrit en
    Septembre 2006
    Messages
    49
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 49
    Points : 30
    Points
    30
    Par défaut formulaire et fonction mail()
    merci leclone pour ton aide je recois le mail maintenant mais mais pas les données du formulaire rempli
    voici ce que je recois:

    nom : ,
    prenom : ,
    ville : ,
    phone : ,
    Mail : ,
    reponse : ,


    a quoi peut etre dû ca? stp

  4. #4
    Membre habitué
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    382
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France, Nord (Nord Pas de Calais)

    Informations forums :
    Inscription : Mai 2006
    Messages : 382
    Points : 151
    Points
    151
    Par défaut
    voici ton code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    $reponse_envoye =
    'nom : ' . $nom ."rn".
    'prenom :' . $prenom . "rn".
    'phone : ' . $phone ."rn" .
    'mail : ' . $mail ."rn" .
    'reponse : ' . $reponse ."rn" .
    essai avec ça :
    le corps du message

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $corps.="nom : $nom <br> prenom : $prenom <br> phone : $phone <br> mail : $mail <br> reponse : $reponse";
    Si ça ne marche pas, montre moi ton code
    Développeur LotusScript

  5. #5
    Nouveau membre du Club
    Inscrit en
    Septembre 2006
    Messages
    49
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 49
    Points : 30
    Points
    30
    Par défaut formulaire et fonction mail()
    Leclone j'ai toujours le meme problème je ne recois pas les donnée du formulaire, meme avec ton nouveau code.

    di est ce que cela peut etre du a ce message?:

    Notice: Undefined index: nom in c:\program files\easyphp1-8\www\togodumevi\send_mail.php on line 2

    Notice: Undefined index: prenom in c:\program files\easyphp1-8\www\togodumevi\send_mail.php on line 3

    Notice: Undefined index: town in c:\program files\easyphp1-8\www\togodumevi\send_mail.php on line 4

    Notice: Undefined index: phone in c:\program files\easyphp1-8\www\togodumevi\send_mail.php on line 5

    Notice: Undefined index: mail in c:\program files\easyphp1-8\www\togodumevi\send_mail.php on line 6

    Notice: Undefined index: reponse in c:\program files\easyphp1-8\www\togodumevi\send_mail.php on line 7

  6. #6
    Membre habitué
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    382
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France, Nord (Nord Pas de Calais)

    Informations forums :
    Inscription : Mai 2006
    Messages : 382
    Points : 151
    Points
    151
    Par défaut
    est ce que tu peux me montrer ton code stp???

    merci
    Développeur LotusScript

  7. #7
    Nouveau membre du Club
    Inscrit en
    Septembre 2006
    Messages
    49
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 49
    Points : 30
    Points
    30
    Par défaut formulaire et fonction mail()
    voici mon 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
     
    <?php 
    $nom = $_POST["nom"];
    $prenom = $_POST["prenom"];
    $town = $_POST["town"];
    $phone = $_POST["phone"];
    $mail=$_POST["mail"];
    $reponse = $_POST["reponse"]; 
     
    /////voici la version Mine 
    $headers = "MIME-Version: 1.0\r\n"; 
     
    //////ici on détermine le mail en format text 
    $headers .= "Content-type: text/plain; charset=iso-8859-1\r\n"; 
     
    ////ici on détermine l'expediteur et l'adresse de réponse 
    $headers .= "From: $nom <$mail>\r\nReply-to : $nom <$mail>\nX-Mailer:PHP"; 
     
    $subject="jeu"; 
    $destinataire="jeu_wu@togodumevi.com"; 
    $body="nom : " . $nom." , \n prenom : " . $prenom." , \n ville : " . $town." , \n phone : " . $phone." , \n Mail : " . $mail." , \n reponse : " . $reponse.","; 
    if (mail($destinataire,$subject,$body,$headers)) { 
    echo "Votre mail a été envoyé"; 
    } else { 
    echo "Une erreur s\'est produite"; 
    } 
    ?>

  8. #8
    Membre habitué
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    382
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France, Nord (Nord Pas de Calais)

    Informations forums :
    Inscription : Mai 2006
    Messages : 382
    Points : 151
    Points
    151
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    <?php 
    $nom=$_POST['nom'];
    $prenom=$_POST['prenom'];
    $town=$_POST['town'];
    $phone=$_POST['phone'];
    $mail=$_POST['mail'];
    $reponse=$_POST['reponse']; 
    echo ($nom) ;
    ?>
    essai de faire un echo pour voir si tu recup bien les valeurs avant de faire des modifications
    Développeur LotusScript

  9. #9
    Nouveau membre du Club
    Inscrit en
    Septembre 2006
    Messages
    49
    Détails du profil
    Informations forums :
    Inscription : Septembre 2006
    Messages : 49
    Points : 30
    Points
    30
    Par défaut formulaire et fonction mail()
    no kan je fais echo s'affiche pas le nom

    stp voici mon formulaire::

    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
     
    <form action="send_mail.php"  method="post" name="contactform"  enctype="text/plain">
                              <table cellspacing="2">
                                <tbody>
                                <tr> 
                                  <td align="right" nowrap="nowrap"> <strong>Nom: *</strong></td>
     
                                  <td> 
                                    <input name="nom" class="input-textfield-contactform"  type="text">
                                  </td>
                                </tr>
                                <tr> 
                                  <td align="right" nowrap="nowrap"> <strong>Prénom: *</strong></td>
                                  <td> 
                                    <input  name="prenom" class="input-textfield-contactform"  type="text">
                                  </td>
                                </tr>
     
    							<tr> 
                                  <td align="right" nowrap="nowrap"> <strong>Ville: *</strong></td>
                                  <td> 
                                    <input name="town" class="input-textfield-contactform"  type="text">
                                  </td>
                                </tr>
     
                                <tr> 
                                  <td align="right" nowrap="nowrap"> <strong>Téléphone: *</strong></td>
                                  <td> 
                                    <input name="phone" class="input-textfield-contactform"  type="text">
                                  </td>
                                </tr>
    							<tr> 
                                  <td align="right" nowrap="nowrap"> <strong>Mail: *</strong></td>
                                  <td> 
                                    <input name="mail" class="input-textfield-contactform"  type="text">
                                  </td>
                                </tr>
                               <tr valign="top">
    						     <td>
    							 <br><b>vos réponses :</b> *</td>
      <td><textarea name="reponse" cols="25" rows="5" class="textarea-textfield-contactform">
      1-
     
      2-
     
      3-
      </textarea>
    					  </td>
    							 </tr>
    							    <tr valign="top">
    								  <td>
    								  <input value="envoyer"  onClick="javascript:if (testcontactform()) { document.contactform.submit(); }" type="button"/>
    								  </td>
    								 </tr>
     
        </tbody></table>
      </form>
    stp verifie moi ca s'il ya des erreurs stp

  10. #10
    Membre habitué
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    382
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France, Nord (Nord Pas de Calais)

    Informations forums :
    Inscription : Mai 2006
    Messages : 382
    Points : 151
    Points
    151
    Par défaut
    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
    <?php
    echo "<form action='send_mail.php'  method='post' name='contactform'  enctype='text/plain'>
                              <table cellspacing='2'>
                                <tbody>
                                <tr> 
                                  <td align='right' nowrap='nowrap'> <strong>Nom: *</strong></td>
     
                                  <td> 
                                    <input name='nom' class='input-textfield-contactform'  type='text'>
                                  </td>
                                </tr>
                                <tr> 
                                  <td align='right' nowrap='nowrap'> <strong>Prénom: *</strong></td>
                                  <td> 
                                    <input  name='prenom' class='input-textfield-contactform'  type='text'>
                                  </td>
                                </tr>
                               
    							<tr> 
                                  <td align='right' nowrap='nowrap'> <strong>Ville: *</strong></td>
                                  <td> 
                                    <input name='town' class='input-textfield-contactform'  type='text'>
                                  </td>
                                </tr>
                               
                                <tr> 
                                  <td align='right' nowrap='nowrap'> <strong>Téléphone: *</strong></td>
                                  <td> 
                                    <input name='phone' class='input-textfield-contactform'  type='text'>
                                  </td>
                                </tr>
    							<tr> 
                                  <td align='right' nowrap='nowrap'> <strong>Mail: *</strong></td>
                                  <td> 
                                    <input name='mail' class='input-textfield-contactform'  type='text'>
                                  </td>
                                </tr>
                               <tr valign='top'>
    						     <td>
    							 <br><b>vos réponses :</b> *</td>
      <td><textarea name='reponse' cols='25' rows='5' class='textarea-textfield-contactform'>
      1-
      
      2-
      
      3-
      </textarea>
    					  </td>
    							 </tr>
    							    <tr valign='top'>
    								  <td>
    								  <input value='envoyer'  onClick='javascript:if (testcontactform()) { document.contactform.submit(); }' type='button'/>
    								  </td>
    								 </tr>
    							
        </tbody></table>
      </form> " ;
    ?>
    Fais un copier-coller du code au dessus et modifie l'extension de ton fichier (celui qui contient le formulaire, tu le met en nomfichier.php)

    après ça, regarde s'il y a quelque chose dans le echo.
    Développeur LotusScript

Discussions similaires

  1. fonction mail caprisieuse d'un formulaire a l'autre
    Par cedcyr dans le forum Langage
    Réponses: 2
    Dernier message: 12/11/2013, 22h45
  2. probleme fonction mail et formulaire
    Par popouerk dans le forum Langage
    Réponses: 1
    Dernier message: 19/04/2011, 22h36
  3. [FLASH MX] Problème flash et fonction mail() php
    Par proutcore dans le forum Flash
    Réponses: 7
    Dernier message: 21/05/2007, 12h21
  4. [Mail] valider par mail un formulaire et fonction rand
    Par guillaume2vo dans le forum Langage
    Réponses: 2
    Dernier message: 17/09/2006, 20h37
  5. Réponses: 6
    Dernier message: 11/10/2004, 14h58

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo