Aide pour un formulaire

princegon Messages postés 1 Statut Membre -  
Nico_ Messages postés 1302 Statut Membre -
Bonjour,
voila j'ai trouver un code pour un formulaire avec dreamweaver tout fonctionne sauf que je ne recoit pas le message sur ma messagerie si quelqu'un sait pourquoi merci de m'aider

le code actuel est

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>contact</title>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
<style type="text/css">
<!--
.Style1 {font-size: 36px}
-->
</style>
</head>

<body>
<p align="center">
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0','width','50','height','37','align','left','src','button1','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','button1' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload2.macromedia.com/get/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="50" height="37" align="left">
<param name="movie" value="button1.swf" />
<param name="quality" value="high" />
<embed src="button1.swf" width="50" height="37" align="left" quality="high" pluginspage="https://get.adobe.com/flashplayer/" type="application/x-shockwave-flash" ></embed>
</object></noscript>
<span class="Style1">contact</span></p>
<p>
<?php if ($_POST['message'] == "") { ?>
</p>
<form name="envoiemail" id="envoiemail" method="post" action="">
<p>Votre nom :<br />
<input name="nom" type="text" id="nom" size="50" />
</p>
<p>Votre email :<br />
<input name="email" type="text" id="email" size="50" />
</p>
<p>Sujet de votre email :<br />
<input name="sujet" type="text" id="sujet" size="50" />
</p>
<p>Message :<br />
<textarea name="message" cols="50" rows="10"></textarea>
</p>
<p>
<input name="Submit" type="submit" onclick="MM_validateForm('nom','','R', 'email','','NisEmail','sujet','','R','textarea','','R');return document.MM_returnValue" value="Envoyer" />
</p>
</form>
<?php } else {
mail("lopemail@hotmail.com", $_POST['sujet'], $_POST['message'],"From: ".$_POST['nom']."<".$_POST['email'].">");
?>
<p>Le message a bien été envoyé, merci.
<div align="center"><a href="http://www.loicetaurore.com">retour au site par ici </a></div></p>
<?php } ?>
</body>
</html>

1 réponse

Nico_ Messages postés 1302 Statut Membre 189
 
salut,

voici le le code complet. Votre adresse Mail est renté.
la valeurs de champs Email et objet sont récupéré dans l'entête des mails.

Bonne soirée

Code a remplacer par celui si dessous.

<?php

$email_dest = "lopemail@hotmail.com";

if ($_POST['envoi']) {

// E-mail headers:
$headers ="MIME-Version: 1.0 \n";
$headers .=($_POST['zone_email']);


$headers .="Content-Type: text/html; charset=iso-8859-1 \n";

$subject =($_POST['champ2']);

$partie_entete = "<html><head>
<meta http-equiv=Content-Type content=text/html; charset=iso-8859-1>
</head>
<body bgcolor=#FFFFFF>";

for ($a=1; $a<= $_POST['nbre_champs_texte']; $a++) {
$partie_champs_texte .= "<font face='Verdana' size='2' color='#003366'>" . $_POST['titre_champ'.$a] . " = " . $_POST['champ'.$a] . "</font><br>";
}

if ($_POST['nbre_zone_email'] != 0) {
$partie_zone_email = "<font face='Verdana' size='2' color='#003366'>" . $_POST['titre_email'] . " = " . $_POST['zone_email'] . "</font><br>";
}

if ($_POST['nbre_zones_texte'] != 0) {
$partie_zone_texte = "<font face='Verdana' size='2' color='#003366'>" . $_POST['titre_zone'] . " = " . $_POST['zone_texte'] . "</font><br>";
$partie_zone_texte = stripslashes($partie_zone_texte);
}

$fin = "</body></html>";

$sortie = $partie_entete . $partie_champs_texte . $partie_zone_email . $partie_zone_texte . $fin;

// Send the e-mail
if (@!mail($email_dest,$subject,$sortie,$headers)) {
echo("Envoi du formulaire impossible");
} else { // Closing if !mail...

// Renvoi à la page de remerciement
echo("Le message a bien été envoyé, merci.");
exit();

} // Fin du else
} // Closing if edit
?><html><head><script language="JavaScript">function verifSelection() {if (mail_form.champ1.value == "") {
alert("Merci de remplire tout les champs")
return false
} if (mail_form.champ2.value == "") {
alert("Merci de remplire tout les champs")
return false
} if (mail_form.zone_email.value == "") {
alert("Merci de remplire tout les champs")
return false
}

invalidChars = " /:,;'"

for (i=0; i<invalidChars.length; i++) {	// does it contain any invalid characters?
badChar = invalidChars.charAt(i)

if (mail_form.zone_email.value.indexOf(badChar,0) > -1) {
alert("Votre adresse e-mail contient des caractères invalides. Veuillez vérifier.")
mail_form.zone_email.focus()
return false
}
}

atPos = mail_form.zone_email.value.indexOf("@",1)			// there must be one "@" symbol
if (atPos == -1) {
alert('Votre adresse e-mail ne contient pas le signe "@". Veuillez vérifier.')
mail_form.zone_email.focus()
return false
}

if (mail_form.zone_email.value.indexOf("@",atPos+1) != -1) {	// and only one "@" symbol
alert('Il ne doit y avoir qu\'un signe "@". Veuillez vérifier.')
mail_form.zone_email.focus()
return false
}

periodPos = mail_form.zone_email.value.indexOf(".",atPos)

if (periodPos == -1) {					// and at least one "." after the "@"
alert('Vous avez oublié le point "." après le signe "@". Veuillez vérifier.')
mail_form.zone_email.focus()
return false
}

if (periodPos+3 > mail_form.zone_email.value.length)	{		// must be at least 2 characters after the 
alert('Il doit y avoir au moins deux caractères après le signe ".". Veuillez vérifier.')
mail_form.zone_email.focus()
return false
}if (mail_form.zone_texte.value == "") {
alert("Merci de remplire tout les champs")
return false
} } // Fin de la fonction

</script><title>Contact</title></head><body><form name="mail_form" method="post" action="<?=$_SERVER['PHP_SELF']?>" onSubmit="return verifSelection()">
  <div align="center"></div>
<p align="center">
<table width="566" border="0" align="center">
<p align="center"></p><tr>
      <td><font face="Verdana" size="2">Votre Nom:</font></td>
      <td><input name="champ1" type="text"></td>
    </tr><tr>
      <td><font face="Verdana" size="2">Votre email:</font></td>
      <td><input name="zone_email" type="text"></td>
    </tr><tr>
      <td width><font face="Verdana" size="2">Sujet de votre emaill:</font></td>
      <td width><input name="champ2" type="text"></td>
    </tr><tr>
      <td valign="top"><font face="Verdana" size="2">Message:</font></td>
      <td><textarea name="zone_texte" cols="50" rows="10"></textarea></td>
    </tr><tr>
      <td valign="top"><input name="nbre_champs_texte" type="hidden" id="nbre_champs_texte" value="2">
        <input name="nbre_zones_texte" type="hidden" value="1">
<input name="nbre_zone_email" type="hidden" value="1">
<input name="titre_champ1" type="hidden" value="Votre Nom:"><input name="titre_champ2" type="hidden" value="Sujet de votre emaill:"><input name="titre_email" type="hidden" value="Votre email:"><input name="titre_zone" type="hidden" value="Message:"></td>
      <td><div align="center">
<input type="reset" name="Reset" value="Effacer">          
<input type="submit" name="envoi" value="Envoyer">
        </div></td>
    </tr>
  </table>
  <div align="center"></div>
</form></body></html>
0