格式化Php表单变量

Tom*_*Tom 0 php forms email

用户填写一张表格,该表格通过读取数据的变量发送到我的电子邮箱.

我想在每个用户条目上方都有标题,并在电子邮件中显示为粗体.

电子邮件应为:

占用:

用户输入的数据.

我试过了

$Occupationheader = "<strong>"."OCCUPATION"."</strong>"."\n\n" ;

$Occupationheader = "<strong>OCCUPATION:<strong>\n\n";

数据将发送到电子邮件,如下所示:(这样可行,但希望以粗体格式化标题).

mail( "myemailaddress", "subjectmatter", $Occupationheader.$Occupation);

有任何想法吗?

多谢你们.

Unk*_*337 5

$mailContent = "<html>
<body>
<strong>HEADER</strong>
<br/>message
</body>
</html>";
Run Code Online (Sandbox Code Playgroud)


Fun*_*ner 5

注意:这是作为附加答案提供的.

没有看到完整的源代码,我在下面提供我的(附加)答案.

以下内容需要出现在您的代码中,以便以HTML格式发送电子邮件:

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
Run Code Online (Sandbox Code Playgroud)

根据关于该主题的PHP手册:http://php.net/manual/en/function.mail.php