bonjour,
je crée un petit site en php je bloque sur un formulaire avec des champ obligatoire j'ai declaré l'ensemble des variables à renvoyer par mail cela ne fonctionne pas? Un oeil extérieur est averti pourrai m'aider.
merci par avance .
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80 <!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> </head> <?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 .= $message; //-------------------------------------------------------------- //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("<a href="formulaire document telechager.php">Document sans titre</a>"); ?> <body><div><img src="file:///L|/Informatique -Téléphone/bandeau.gif" alt="" width="982" height="112" /></div> <p> </p> <form action="<?php print $_SERVER["PHP_SELF"]; ?>" method="post" enctype="multipart/form-data" name="form1" id="form1"></form> <tr><p> </p> <div align="center">(*) Champs obligatoires</div> <tr><p></p> <div align="center"><span class="Style1">Nom * </span><input name="nom" type="text" id="nom" value="<?php print $nom ?>" size="50" maxlength="100" /></div> <tr><p></p> <div align="center"><span class="Style1">Prénom * </span><input name="prenom" type="text" id="nom" value="<?php print $prenom ?>" size="50" maxlength="100" /></div> <tr><p></p> <div align="center"><span class="Style1">Adresse * </span><input name="adresse" type="text" id="nom" value="<?php print $adresse ?>" size="50" maxlength="100" /></div> <tr><p></p> <div align="center"><span class="Style1">Code postal * </span><input name="code postal " type="text" id="nom" value="<?php print $cp ?>" size="50" maxlength="100" /></div> <tr><p></p> <div align="center"><span class="Style1">Ville * </span><input name="ville" type="text" id="nom" value="<?php print $ville ?>" size="50" maxlength="100" /></div> <tr><p></p> <div align="center"><span class="Style1">Téléphone * </span><input name="tel" type="text" id="nom" value="<?php print $tel ?>" size="50" maxlength="100" /></div> <tr><p></p> <div align="center"><span class="Style1">Email * </span><input name="mail" type="text" id="nom" value="<?php print $mail ?>" size="50" maxlength="100" /></div> <p></p> <div align="center"><input type="submit" name="Envoyer" id="Envoyer" value="Envoyer" /> </div> </body> </html>






Répondre avec citation
Partager