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 59 60 61 62 63 64 65 66 67 68
|
<!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>verif.php</title>
<style type="text/css">
<!--
.Style1 {font-family: "Times New Roman", Times, serif}
-->
</style>
</head>
<body>
<?php
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$adresse = $_POST['adresse'];
$cp= $_POST['cp'];
$ville=$_POST['ville'];
$tel=$_POST['telephone'];
$mail=$_POST['mail'];
$erreurs = array();
if( empty($nom)) array_push($erreurs, "il manque votre nom");
if( empty($prenom)) array_push($erreurs, "il manque votre prénom");
if( empty($adresse)) array_push($erreurs,"il manque votre adresse");
if( empty($cp)) array_push($erreurs, "il manque votre code postal");
if( empty($ville)) array_push($erreurs, "il manque votre ville");
if( empty($tel)) array_push($erreurs,"il manque votre téléphone");
if( empty($mail)) array_push($erreurs, "il manque votre email");
if(empty($erreurs))
{
$from = $email;
$reply = $from;
$to = "monmail@moi.fr";
//Mise en forme du contenu au format HTML-----------------------
$contenu = "message de : ".$prenom." ".$nom;
$contenu .= "<br /> Tel: ".$tel;
$contenu .= "<br /> Message: <br />";
$contenu .= ($nom,$prenom,$adresse,$cp,$ville,$tel,$mail);
//--------------------------------------------------------------
//Entêtes de formatage de l'email en mode HTML
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\n";
$headers .= 'From: '.$from."\n";
$reply = $headers."Reply-to: ".$reply."\n";
//---------------------------------------------------------------
//Déclenchement de l'email et reroutage vers une autre page-----
$resultat = mail($to, $subject, $contenu, $reply);
if($resultat)
{
echo "email envoyé";
}
else { echo "Echec dans l'envoi de l'email"; }
} //fin du if(empty($erreurs))
header("formulaire_document_telechager.php");
?>
</body>
</html> |
Partager