Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
发送空白消息的PHP电子邮件表单_Php_Html_Email - Fatal编程技术网

发送空白消息的PHP电子邮件表单

发送空白消息的PHP电子邮件表单,php,html,email,Php,Html,Email,我在我的联系人表单中添加了一个clean()函数来去除特殊字符,出于某种原因,它只发送空白消息,没有主题,什么都没有。如果我从字符串中删除该函数,它就会工作 这是表格的一部分: function clean($string) { preg_replace('/[^a-zA-Z0-9\s]/', '', strip_tags(html_entity_decode($string))); } if (isset($_REQUEST['email'])) {//if "email" is fil

我在我的联系人表单中添加了一个clean()函数来去除特殊字符,出于某种原因,它只发送空白消息,没有主题,什么都没有。如果我从字符串中删除该函数,它就会工作

这是表格的一部分:

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("support@pattersoncode.ca", "Subject: $product",
    $message, "From: $email" );
    echo "I'll be in contact shortly, thanks! :)";
    }
函数清理($string){
preg_替换('/[^a-zA-Z0-9\s]/','',带标签(html_实体_解码($string));
}
如果(isset($_请求['email']))
{//如果填写了“电子邮件”,请继续
//检查电子邮件地址是否无效
$mailcheck=spamcheck($_请求['email']);
如果($mailcheck==FALSE)
{
回显“无效输入,请”;
}
其他的
{//发送电子邮件
$email=$_请求['email'];
$product=清洁($_请求['product']);
$message=clean($_请求['message']);
邮件(“support@pattersoncode.ca“,”主题:$product“,
$message,“发件人:$email”);
echo“我很快就会联系的,谢谢!:)”;
}

您需要从函数返回一个值

function clean($string) {
return preg_replace('/[^a-zA-Z0-9\s]/', '', strip_tags(html_entity_decode($string)));
}

您没有从函数返回任何值