Good afternoon,
I am new to this site and have a question regarding HTML and PHP. I have a contact form on my site and a PHP file that is being used to send a confirmation email (autoresponder email) however I need to format a large chunk of copy to be sent in the email.
I need to be able to add HTML formatted copy in this section ($pfw_message = "This will be the area where I need to format email copy";) if possible. Please excuse me if I am wrong in thinking this is even a possibility. I dont know a thing about PHP besides trying things with trial and error.
If its not possible to add formatted copy to PHP does anybody have an idea of what I can do?
Thanks.
<?php
// Receiving variables
@$full_name = addslashes($_POST['full_name']);
@$email = addslashes($_POST['email']);
@$phone_number = addslashes($_POST['phone_number']);
@$mailing_list = addslashes($_POST['mailing_list']);
// Validation
if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email))
{
header("Location: error.html");
exit;
}
//Sending Email to form owner
# Email to Owner
$pfw_header = "From: $email";
$pfw_subject = "Fee contact form";
// CHANGE THIS....
$pfw_email_to = "chughes@email.com";
//......................
$pfw_message = "full_name: $full_name\n"
. "email: $email\n"
. "phone_number: $phone_number\n"
. "mailing_list: $mailing_list\n"
. "\n";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
//Sending auto respond Email to user
# Email to Owner
// CHANGE THIS....
$pfw_header = "From: info@email.com";
//...................................
$pfw_subject = "Spay/Neuter Clinic - Fees - (Auto Responder-do not reply)";
$pfw_email_to = "$email";
$pfw_message = "This will be the area where I need to format email copy";
@mail($pfw_email_to, $pfw_subject ,$pfw_message ,$pfw_header ) ;
header("Location: thank_you.html");
?>
New to PHP, need help
Moderator: General Moderators
Re: New to PHP, need help
If you look at the fourth example on the PHP documentation for mail() you'll see how it can be done. It's not complicated but there are a couple things your code has to do.