Bonjour,
J'ai acheté un thème sur internet, tout se passe très bien ... Mais j'ai un probleme avec mon formulaire de contact.
Voici ma page CONTACT.HTML :
(Parti qui traite du formulaire)
<!-- contact form -->
<div id="confirm">
<form id="form1" method="post" action="bat/MailHandler.php">
<div class="success"> Contact form submitted! We will be in touch soon.</div>
<fieldset>
<label class="name">
<input type="text" value="Name:" />
<span class="error">*This is not a valid name.</span> <span class="empty">*This field is required.</span>
</label>
<label class="email">
<input type="email" value="E-mail:" />
<span class="error">*This is not a valid email address.</span> <span class="empty">*This field is required.</span>
</label>
<label class="phone">
<input type="tel" value="Phone:" />
<span class="error">*This is not a valid phone number.</span> <span class="empty">*This field is required.</span>
</label>
<label class="message">
<textarea>Message:</textarea>
<span class="error">*The message is too short.</span> <span class="empty">*This field is required.</span>
</label>
<div class="clear"></div>
<div class="btns">
<div class="button-shadow"><a class="button-1" href="#" data-type="submit"><span>send message</span></a></div>
<div class="button-shadow"><a class="button-1" href="#" data-type="reset"><span>Clear</span></a></div> </div>
</fieldset>
</form>
</div>
<!-- end contact form -->
Voici mon fichier MailHandler.php:
(Qui se trouve dans le dossier "bat" )
<?php
$owner_email = $_POST["JE MET MON ADRESSES MAIL ICI"];
$headers = 'From:' . $_POST["email"];
$subject = 'A message from your site visitor ' . $_POST["name"];
$messageBody = "";
if($_POST['name']!='nope'){
$messageBody .= '<p>Visitor: ' . $_POST["name"] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['email']!='nope'){
$messageBody .= '<p>Email Address: ' . $_POST['email'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}else{
$headers = '';
}
if($_POST['state']!='nope'){
$messageBody .= '<p>State: ' . $_POST['state'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['phone']!='nope'){
$messageBody .= '<p>Phone Number: ' . $_POST['phone'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['fax']!='nope'){
$messageBody .= '<p>Fax Number: ' . $_POST['fax'] . '</p>' . "\n";
$messageBody .= '<br>' . "\n";
}
if($_POST['message']!='nope'){
$messageBody .= '<p>Message: ' . $_POST['message'] . '</p>' . "\n";
}
if($_POST["stripHTML"] == 'true'){
$messageBody = strip_tags($messageBody);
}
try{
if(!mail($owner_email, $subject, $messageBody, $headers)){
throw new Exception('mail failed');
}else{
echo 'mail sent';
}
}catch(Exception $e){
echo $e->getMessage() ."\n";
}
?>
Savez-vous pourquoi je ne reçois rien ??
Merci beaucoup pour votre aide