Forum Moderators: coopster
Success: all fields were filled out correctly and has been sent to the appropriate department"; } else { echo "
email could not be sent"; }?>
here is my script Please point me in the right direction to fix this or if im missing " or ' let me know. I dont get any error messages.
Pat
</php
// creating an error messages
$errmsg = "";
if (!isset($_POST['name']) ¦¦ empty($_POST['name'])) $errmsg .= "<p>I'm sorry it seems like you have forgotten to include your name in the form";
if (!isset($_POST['email']) ¦¦ empty($_POST['email'])) $errmsg .= "<p>I'm sorry it seems like you have forgotten to include your E-mail address in the form this may be helpful if you would like us to contact you";
if (!isset($_POST['name']) ¦¦ empty($_POST['name'])) $errmsg .= "<p>I'm sorry it seems like you have forgotten to include your name in the form";
if (!isset($_POST['suggestion']) ¦¦ empty($_POST['suggestion'])) $errmsg .= "<p>I'm sorry it seems like you have forgotten to include your comments in the form";
if ($_POST['subject'] == "none") $errmsg .= "<p>Please select a catagory you would like to comment on";
if ($errmsg!= "") {
echo $errmsg;
echo "<a href=\"javascript:history.back();\">Please go back and fill out any missing fields</a>";
exit;
}
//opening and sending feedback email
$toaddress = 'pat@mysite.com';
$subject = 'subject';
$mailcontent = 'Customer name: '.$name."\n"
.'Customer email: '.$email."\n"
.'Customer Telephone number: '.$telephone."\n"
."Customer comments: \n".$suggestion."\n";
$fromaddress = 'From: feedback@mysite.com';
else{
mail ($toaddress, $subject, $mailcontent, $fromaddress)
}
if (mail($toaddress, $subject, $mailcontent, $fromaddress))
echo "<p>Success: all fields were filled out correctly and has been sent to the appropriate departments";
}
else {
echo "<p>email could not be sent";
}
?>
$toaddress = 'pat@mysite.com';
$subject = 'subject';
$mailcontent = 'Customer name: '.$name."\n"
.'Customer email: '.$email."\n"
.'Customer Telephone number: '.$telephone."\n"
."Customer comments: \n".$suggestion."\n";
$fromaddress = 'From: feedback@mysite.com';
else{
mail ($toaddress, $subject, $mailcontent, $fromaddress)
}
Should be:
if ($errmsg!= "") {
echo $errmsg;
echo "<a href=\"javascript:history.back();\">Please go back and fill out any missing fields</a>";
exit;
}else{
//opening and sending feedback email
$toaddress = 'pat@mysite.com';
$subject = 'subject';
$mailcontent = 'Customer name: '.$name."\n"
.'Customer email: '.$email."\n"
.'Customer Telephone number: '.$telephone."\n"
."Customer comments: \n".$suggestion."\n";
$fromaddress = 'From: feedback@mysite.com';
mail ($toaddress, $subject, $mailcontent, $fromaddress)
}