0
특수 문자를 제거하기 위해 내 연락처 양식에 clean() 함수를 추가했습니다. 어떤 이유로 든 공백 메시지, 제목 없음, 아무것도 보내지 않고 있습니다. 문자열에서 함수를 제거하면 작동합니다.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! :)";
}
함수에서 값을 반환하지 않습니다. –