if(empty($_POST)=== false){
//send email
$fullname = $_REQUEST['fullname'];
$names = $_REQUEST["fullname"];
$phonenumber = $_REQUEST['phonenumber'];
$mobilenumber = $_REQUEST['mobilenumber'];
$postcode = $_REQUEST['postcode'];
$level = $_REQUEST['level'];
$creditors = $_REQUEST['creditors'] ;
$status = $_REQUEST['status'] ;
$monthly = $_REQUEST['monthly'] ;
$partner = $_REQUEST['partner'] ;
$subject="The Debt Advice Service";
$message = "Full Name: ".$fullname. " \n\n";
$message .="Phone Number: ". $phonenumber."\n\n";
$message .="Mobile Number: ".$mobilenumber."\n\n";
$message .="Postcode: ".$postcode."\n\n";
$message .="Level Of Debt: ".$level."\n\n";
$message .="How many debts / creditors: ".$creditors."\n\n";
$message .="Employment Status: ".$status."\n\n";
$message .="Monthly Income (£): ".$monthly."\n\n";
$message .="Partner's Income(£): ".$partner."\n\n";
$headers = 'From: '.$names."\r\n".
'X-Mailer: PHP/' . phpversion();
//$name = $_REQUEST['fullname'];
//$headers = "From: $name";
mail("mymail.com", $subject, $message, $headers);
mail("mymail.com", $subject, $message, $headers);
}
输出:
我在$header
遇到了一个问题,因为如果我输入一个单词的名字,该名称是有效的,但如果我输入一个全名,发件人会告诉“未知的发件人”,请帮我解决我的问题。< / p>
答案 0 :(得分:0)
我解决了这个问题的答案,你必须填写所有内容才能查看发件人的姓名
答案 1 :(得分:0)
首先填写所有内容,以便表单包含要解析所有字段的数据。之后,您可以使用JQuery或第三方插件(parsley.js)进行数据验证,以填充和格式化所需的内容。通过这种方式,您的表单可以完美运行。