having a problem getting my simple php email contact form working. No errors are generated or returned, but I’m not receiving any emails.
This is my form http://bitstream.ca/beta2/contact.html
And the php I am using( with my proper email of course)
Can anyone see any errors with the form code below?
What are some general debugging steps to try?
Thanks in advance!
<?php
$errors = '';
$myemail = 'foo@foo.foo';//<-----Put Your email address here.
if(empty($_POST['name']) ||
empty($_POST['email']) ||
empty($_POST['message']))
{
$errors .= "\n Error: all fields are required";
}
$name = $_POST['name'];
$email_address = $_POST['email'];
$message = $_POST['message'];
if (!preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z {2,3})$/i", $email_address))
{
$errors .= "\n Error: Invalid email address";
}
if( empty($errors))
{
header('Location: contact-form-thank-you.html');
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Contact form handler</title>
</head>
<body>
<!-- This page is displayed only if there is some error -->
<?php
echo nl2br($errors);
?>
</body>
</html>
You can try