简体   繁体   中英

Confirmation email from PHP form

I have a php form that works great. The confirmation email go to user but I want it to post there name before the message. It wont post the name right now. Just posts the message. I want it to say something like., Thank you FULL_Name (Then message) Any help would rock.

// 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" );     

If I'm understanding this correctly, you just need to insert a variable into a string.

$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

In your code you're adding the full_name to $msg. and then you replace the content of the variable with the message:

 $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";   

In this code you're first setting $msg with the full_name, and then adding the rest of the message.

 $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";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM