Hello together,
this code of contact form works - but i dont like the alert, so i decided to modify the code, that it should write into a div "thank you..". The problem is, it doesnt work? It think the issue is because the echo doesnt know where to write in...Maybe you can help me - THX
/// HTML ///
<section id="main-content">
<div class="text-intro"><h2>CONTACT</h2></div>
<div id="thanks"></div>
<div class="columns features">
<br />
<form action="contact.php" method="post" id="contact-form" class="contact-form">
<textarea id='message' maxlength='10000' name='message' placeholder='Hello...'></textarea>
<div class='crayonico'></div>
<input class='text-input' id='senderEmail' maxlength='50' name='email' placeholder='E-Mail' type='email'>
<div class='emailico'></div>
<input class='btn btn-input' id='sendMessage' name='sendMessage' type='submit' value='SEND'>
</form>
<br /><br /><br /><br /><br />
</div>
/// PHP ///
<?php
$field_email = $_POST['email'];
$field_message = $_POST['message'];
$mail_to = 'email@email.de ';
$subject = 'Message from a site visitor '.$field_name;
$body_message .= 'E-mail: '.$field_email."\n";
$body_message .= 'Message: '.$field_message;
$headers = 'From: '.$field_email."\r\n";
$headers .= 'Reply-To: '.$field_email."\r\n";
$mail_status = mail($mail_to, $subject, $body_message, $headers);
if ($mail_status){
echo "Thanks for your mail...";
}else{
echo "Please correct your data.";
}
?>
Furthermore, is it possible to only allow sending the message by validation? The issue is that i can send it without an email adress...Thank you so much!