j'ai une newsletter en php qui fonctionne très bien, mon souci c'est que quand la personne click sur send ca le renvoi vers une page html de remerciement grace à location je souhaiterais que quand la personne click sur send une boite de dialogue en javascript s'affiche "email envoyé" quelque chose du genre mais je ne vois pas comment faire si quelqu un pourrait m aiguiller
merci a vous voici le code
Code : Tout sélectionner
<?php
// N'afficher que les erreurs, pas les avertissements...
ini_set("error_reporting", "E_ALL & ~E_NOTICE");
// Adresse de réception du formulaire
$email_dest = "[email protected]";
if ($_POST['envoi']) {
// E-mail headers:
$headers ="MIME-Version: 1.0 \n";
$headers .="From: visiteurs du site <[email protected]>\n";
$headers .="Content-Type: text/html; charset=iso-8859-1 \n";
$subject = "Inscription newsletter";
$partie_entete = "<html><head>
<meta http-equiv=Content-Type content=text/html; charset=iso-8859-1>
</head>
<body bgcolor=#FCE1AA>";
for ($a=1; $a<= $_POST['nbre_champs_texte']; $a++)
if ($_POST['nbre_zone_email'] != 0) {
$partie_zone_email = "<font face='Verdana' size='2' color='#8e1a2c'>" . $_POST['titre_email'] . " = " . $_POST['zone_email'] . "</font><br>";
}
$fin = "</body></html>";
$sortie = $partie_entete . $partie_zone_email. $fin ;
// Send the e-mail
if (@!mail($email_dest,$subject,$sortie,$headers)) {
echo("Forms sending impossible");
} else { // Closing if !mail...
// Renvoi à la page de remerciement
header("Location:thanks.html");
exit();
} // Fin du else
} // Closing if edit
?><html><head><title></title><script language="JavaScript">
function verifSelection() {
if(mail_form.zone_email.value == "ok") {
alert("Veuillez entrer votre adresse email");
mail_form.zone_email.focus();
return false;
}
var exp=new RegExp("^[\\w\\-]+(\\.[\\w\\-]+)*@[\\w\\-]+(\\.[\\w\\-]+)*\\.[\\w\\-]{2,}$", "i");
if(mail_form.zone_email.value !="ok" && !exp.test(mail_form.zone_email.value)){
alert("Adresse email non valide ");
mail_form.zone_email.focus();
return false;
}
}
</script>
</head>
<body>
<form name="mail_form" method="post" action="forms.php" onSubmit="verifSelection()">
<table>
<tr>
<td width>E mail</td>
<td width><input name="zone_email" type="text"></td>
</tr><tr>
<td valign="top"><input name="nbre_champs_texte" type="hidden" id="nbre_champs_texte" value="1">
<input name="nbre_zones_texte" type="hidden" value="1">
<input name="nbre_zone_email" type="hidden" value="1">
<input name="titre_email" type="hidden" value="E mail"></td>
<td><div align="center">
<input type="reset" name="Reset" value="Reset">
<input type="submit" name="envoi" value="Send">
</div></td>
</tr>
</table>
</form>
</body>
</html>