0
我添加了一個乾淨的()函數給我聯繫我的表單去除特殊字符,由於某種原因它只是發送空白消息,沒有主題,什麼都沒有。如果我從字符串中刪除函數,那麼它就可以工作。PHP電子郵件表格發送空白郵件
下面是窗體的一部分:
function clean($string) {
preg_replace('/[^a-zA-Z0-9\s]/', '', strip_tags(html_entity_decode($string)));
}
if (isset($_REQUEST['email']))
{//if "email" is filled out, proceed
//check if the email address is invalid
$mailcheck = spamcheck($_REQUEST['email']);
if ($mailcheck==FALSE)
{
echo "Invalid input. Please <a href='http://pattersoncode.ca/index.php?a=help'>try again</a>";
}
else
{//send email
$email = $_REQUEST['email'] ;
$product = clean($_REQUEST['product']);
$message = clean($_REQUEST['message']);
mail("[email protected]", "Subject: $product",
$message, "From: $email");
echo "I'll be in contact shortly, thanks! :)";
}
你沒有從你的函數返回任何值 –