Why won't the form on this page submit?
www.milesmemorials.com/contact.html
Php for this form is-
<?php
$name = $_POST['name'];
$visitor_email = $_POST['email'];
$message = $_POST['message'];
//Validate first
if(empty($name)||empty($visitor_email))
{
echo "Name and email are mandatory!";
exit;
}
if(IsInjected($visitor_email))
{
echo "Bad email value!";
exit;
}
$email_from = "milesmemorials.com";//<== update the email address
$email_subject = "Message from Miles Memorial contact form";
$email_body = "Visitors name: $name.\n".
"Message:\n $message".
$to = "Ness_Rob@yahoo.com";//<== update the email address
$headers = 'From: '.$visitor_email."\r\n";
$headers .='Reply-To:'.$visitor_email."\r\n";
//Send the email!
mail($to,$email_subject,$email_body,$headers);
//done. redirect to thank-you page.
header('Location: thankyou.html');
// Function to validate against any email injection attempts
function IsInjected($str)
{
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str))
{
return true;
}
else
{
return false;
}
}
?>
Are you using a web host, or your own server?
try changing:
mail($to,$email_subject,$email_body,$headers);
to this:
mail($to,$email_subject,$email_body);
Just to see your result. You should have a "from" already defined in your .cfg file. I realize you want to set your own "from" which is possbile, but try this change just to see if your mail function works without the headers first.
>I do apologise if i seem slow, i am still very new to dreamweaver
Just to be clear, this is not an issue with learning dreamweaver. This is just a lack of understanding of HTML and PHP. You need to learn those first before trying to learn DW.
You have a form field named 'donorName' but are checking for a field named 'name'.
$name = $_POST['name'];
<input name="donerName" type="text"
You need to rename one or the other.
North America
Europe, Middle East and Africa
Asia Pacific