来自PHP表单的确认电子邮件

时间:2013-11-27 19:27:30

标签: php forms

我有一个非常好用的PHP表单。确认电子邮件发送给用户,但我希望它在邮件之前发布名称。它现在不会发布这个名字。只需发布消息即可。我希望它能说出类似的内容。谢谢FULL_Name(然后留言)任何帮助都会摇滚。

// Subject of confirmation email.

 $conf_subject = 'Test Message';



 // Who should the confirmation email be from?

 $conf_sender = 'Test <no-reply@test.com>';

 $msg .= $_POST['Full_Name']."\n";

 $msg = "Thank you for your recent inquiry If you have any questions please call us at 555-555-5555  \n\n";



 mail( $_POST['Email_Address'], $conf_subject, $msg, "From: $conf_sender" );     

2 个答案:

答案 0 :(得分:0)

如果我理解正确,你只需要将一个变量插入一个字符串。

$name = $_POST['Full_Name'];

$msg = "Thank you ".$name." for your recent inquiry If you have any questions please call us at 555-555-5555  \n\n";

http://php.net/manual/en/language.operators.string.php

答案 1 :(得分:0)

在您的代码中,您将full_name添加到$ msg。然后用消息替换变量的内容:

 $msg .= $_POST['Full_Name']."\n";

 $msg = "Thank you for your recent inquiry If you have any questions please call us at 555-555-5555  \n\n";   

在此代码中,您首先使用full_name设置$ msg,然后添加消息的其余部分。

 $msg = $_POST['Full_Name']."\n"; 

 $msg .= "Thank you for your recent inquiry If you have any questions please call us at 555-555-5555  \n\n";