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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
<?php
if(!empty($_POST)){
//
// Debug
//
echo '<pre>';
//print_r($_POST);
echo '</pre>';
}
//
// Récupération normale des informations
//
$missing_fields = array();
if(empty($_POST['nom'])){
$missing_fields[] = '"nom",';
}
if(empty($_POST['prenom'])){
$missing_fields[] = '"prenom",';
}
if(empty($_POST['Telephone'])){
$missing_fields[] = '"Telephone",';
}
if(empty($_POST['date'])){
$missing_fields[] = '"date",';
}
if(empty($missing_fields)){
echo 'Tous les champs ont été renseignés';
}
else{
echo 'Les champs suivants doivent être remplis :<br />';
echo implode('<br />', $missing_fields);
}
echo '<br /><br />';
$regex = "/^[-+.\w]{1,64}@[-.\w]{1,64}\.[-.\w]{2,6}$/i";
$courriel = "nom@domaine.com";
if (preg_match($regex, $courriel)) {
echo "L'adresse $courriel est valide";
} else {
echo "L'adresse $courriel n'est pas valide";
}
if(!empty($_POST)){
//
// Debug
//
echo '<pre>';
echo '</pre>';
}
if( isset($_POST['nom']) ) // si formulaire soumis
{
$to = 'toto@free.fr'
;
$sujet = 'demande de Pre-reservation'
;
$from = $_POST['mail']
;
$nom = "Nom :".$_POST['nom']."\n\r"
;
$Prenom = "Prenom : ".$_POST['prenom']."\n\r"
;
$Telephone = "Telephone :".$_POST['Telephone']."\n\r"
;
$message = "\nMessage:\n\t$Prenom\n\t$nom\n\t$Telephone"
;
if (mail($to , $sujet , $message , "From: $from"))
{
echo'
<script type="text/javascript">
<!--
alert("Votre message a été envoyé .");
//-->
</script>'
;
}
else
{
echo'
<script type="text/javascript">
<!--
alert("Votre message n\'a pas pu être envoyé !!!");
//-->
</script>'
;
}
;
}
;
?> |
Partager