PHP confirmation Email

I have a form and I want a confirmation email sent after the user submits form. I want to display everything from form to there email with also a message. Here is my code.
[php]
// Subject of confirmation email.
$conf_subject = ‘Your recent order’;

// Who should the confirmation email be from?
$conf_sender = ‘My Business <no-reply@no reply.com>’;

$msg = $_POST[‘Name’] . “,\n\nThank you for your interest, Here is confirmation”;

mail( $_POST[‘Email’], $conf_subject, $msg, 'From: ’ . $conf_sender );

$msg = $_POST[‘Address’];

$msg = $_POST[‘City’];

$msg = $_POST[‘State’];

$msg = $_POST[‘Country’];

$msg = $_POST[‘Zip Code’];

$msg = $_POST[‘Phone’];
[/php]

Hello,

To start, in order to append information into a variable, you would use the .= string operator. Now for your code, take a look at my version and see if it does what you want:

[php]// Subject of confirmation email.
$conf_subject = ‘Your recent order’;

// Who should the confirmation email be from?
$conf_sender = ‘My Business <no-reply@no reply.com>’;

$msg = “$_POST[Name],\n\nThank you for your interest, Here is confirmation\n\n”;
$msg .= $_POST[‘Address’]."\n";
$msg .= $_POST[‘City’]."\n";
$msg .= $_POST[‘State’]."\n";
$msg .= $_POST[‘Country’]."\n";
$msg .= $_POST[‘Zip Code’]."\n";
$msg .= $_POST[‘Phone’]."\n";

mail( $_POST[‘Email’], $conf_subject, $msg, “From: $conf_sender” );[/php]

By using the mail() function before you include the information for confirmation, you are not including them before you send the mail message. This code should work for you.

Let me know if this helps,
OpzMaster

Wow! Thanks so much. Perfect bro. Exactly what I was looking for.

Sponsor our Newsletter | Privacy Policy | Terms of Service