So, in other words:
How can this code:
Code:
<?php
if ($_POST["action"] == "send"){
if ($_POST[name] != "" and $_POST[email] != "" and $_POST[subject] != "" and $_POST[message] != "") {
mail ("MY@EMAILADRESS.COM", "contact via website",
"
Name: ".$_POST['name']."
E-mail: ".$_POST['email']."
Subject: ".$_POST['subject']."
Thoughts: ".$_POST['message']."
",
"From: ".$_POST['name']." <".$_POST['email'].">");
$headers[] = 'From: MYDOMAIN.COM';
$subject = "confirmation mail";
$msg = "
(This is an automatically sent message. Please do not reply.)
Dear $_POST[name],
Thanks for your interest.
Surely I will get back to you within a short delay.
In case you need fast response, please do not hesitate calling me.
Thanks.
Enjoy your day.
Kind regards,
B
";
mail($_POST[email], $subject, $msg, implode("\r\n", $headers));
echo '<br><div style="background-color:#fff;border:2px solid #e61875;padding:20px;color:#393939;margin:auto;width:80%;text-align:center;"><p>Thanks for your thoughts. A confirmation mail is on its way and I will get back to you within a short delay.<br>In case you need fast response, please do not hesitate calling me.</p></div>';
}
else{
echo '<br><div style="background-color:#e61875;border:2px solid #fff;padding:20px;margin:auto;width:80%;text-align:center;color:#fff;"><p>Your thoughts could not be shared. Please try again filling in all fields.<br>Thanks.</p></div>';
}
}
?>
be implemented in this html form:
Code:
<form method="post" id="contactForm" action="#contact">
<input type="hidden" name="action" value="send">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<input type="text" id="name" name="name" placeholder="je naam">
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<input type="email" id="email" name="email" placeholder="je email adres">
</div>
</div>
</div>
<div>
<textarea id="comments" name="message" placeholder="je bericht"></textarea>
</div>
<input type="submit" class="submit button" id="send" value="verzend">
</form>
Bookmarks