Quote:
| Originally Posted by DavidMR on the page where the form is where you would put it. can you show the form page? |
here's the php code;
<?php
$field_name = $_POST['cf_name'];
$field_email = $_POST['cf_email'];
$field_message = $_POST['cf_message'];
$mail_to = '--@--.com';
$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('Your message has been sent. We will contact you shortly.');
window.location = 'contact1.html';
</script>
<?php
}
else { ?>
<script language="javascript" type="text/javascript">
alert('Your message could not be delivered. You can contact us at --@--.com');
window.location = 'contact1.html';
</script>
<?php
}
?>
and the code in html ;
<form action="contact1.php" method="post">
Your Name :<br>
<input name="cf_name" type="text" size="25"><br>
Your e-mail address :<br>
<input name="cf_email" type="text" size="25"><br>
Message :<br>
<textarea name="cf_message" cols="30" rows="3"></textarea><br>
<input type="submit" value="Send">
<input type="reset" value="Clear">
</form>