Ajout d'email dans formulaire de contact

Résolu/Fermé
gwen007 Messages postés 78 Date d'inscription mardi 24 février 2015 Statut Membre Dernière intervention 23 juin 2023 - 12 janv. 2016 à 14:23
gwen007 Messages postés 78 Date d'inscription mardi 24 février 2015 Statut Membre Dernière intervention 23 juin 2023 - 12 janv. 2016 à 15:00
Bonjour, je test un formulaire de contact et il est écrit <=== Set static email here. Ajouter email static ici)
ok mais comment ??

<?php
if (isset($_POST) && sizeof($_POST) > 0) {

$to = $_POST['to']['val']; // <=== Set static email here.

if (isset($_POST['formtype'])) {
unset($_POST['formtype']);
}
if (isset($_POST['to'])) {
unset($_POST['to']);
}

$email_address = $_POST['email']['val'];
$email_subject = "Form submitted by: ".$_POST['name']['val'];
$email_body = "You have received a new message. <br/>".
"Here are the details: <br/><br/>";
foreach ($_POST as $key => $value) {
$email_body .= "<strong>" . $value['label'] . ": </strong> " . $value['val'] . "<br/><br/>";
}

$headers = "From:<$email_address>\n";
$headers.= "Content-Type:text/html; charset=UTF-8";
if($email_address != "") {
mail($to,$email_subject,$email_body,$headers);
return true;
}
}
?>


Merci pour votre aide ;)

1 réponse

gwen007 Messages postés 78 Date d'inscription mardi 24 février 2015 Statut Membre Dernière intervention 23 juin 2023 4
12 janv. 2016 à 15:00
j'ai trouvé, il faut mettre comme ceci :

$to = $_POST['to']['val'];

par
$to = monmail@mail.com;


Mais de tout façon ca marche pas.
0