格式化Php表单变量


Formatting Php Form Variable

用户填写一个表格,该表格通过读取其数据的变量发送到我的电子邮件中。

我希望在每个用户条目上方都有标题,并在电子邮件中显示bold

电子邮件应为:

职业:

用户输入的数据

我试过

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

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

数据被发送到电子邮件中,如下所示:(这很有效,但希望将标题设置为粗体)。

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

有什么想法吗?

谢谢大家。

$mailContent = "<html>
<body>
<strong>HEADER</strong>
<br/>message
</body>
</html>";

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

在没有看到完整的源代码的情况下,我在下面提供了我的(额外的)答案。

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

$headers  = 'MIME-Version: 1.0' . "'r'n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "'r'n";

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