Answer the question
In order to leave comments, you need to log in
Set up a feedback form?
Greetings to all, I really need help. In the index file, the feedback form has the following code
<!-- form -->
<form id="contactusform" action="/contact.php" method="post">
<div id="alert" class="zero-lr-margin"></div>
<div class="col-md-6 col-sm-12 text-center center-col xs-margin-btm-ten">
<input name="cf_name" type="text" placeholder="Name" />
<input name="cf_email" type="text" placeholder="Email" />
<textarea name="cf_message" placeholder="Tell us about your big day"></textarea>
<input id="btn-contact" name="send" type="button" value="send message" class="margin-top-zero btn btn-black zero-margin-lr"> </div>
</form>
<!-- end form -->
<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
$mail_to = '[email protected]вв';
$subject = 'Message from a site visitor '.$field_name;
$body_message = 'From: '.$field_name."\n";
$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) { ?>
<script language="javascript" type="text/javascript">
alert('Thank you for the message. We will contact you shortly.');
window.location = 'contact_page.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Message failed. Please, send an email to [email protected]');
window.location = 'contact_page.html';
</script>
<?php
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question