Hello all,
I know html but am sort of lost when it comes to PHP. I don't really know where to even begin to explain my problem.
I am working on a site that deals with real estate. I have created a form on a basic html page( real estate listing page). This form calls a mail.php page to send the contents of the form to the person to whom it is supposed to go (property owner). I setup a test and it all works fine. But here is where the problem begins.
The form I created is on about one hundred pages( for each of the different properties) and they each need to go to different email addresses (property owner of the specific house). The owner's email address is in the database and I have the name of the field. I do not know how to get the mail.php page to "call" the database and insert the email address. I believe that the database we use is Perl. I also need to add a bcc: area in the code but I am not sure how.
The code is below.
[code] <?php
// ************Begin Configure***************
//Put where you want the email to go
$mailto = "me@myemail.com";
//Put your subject in here
$subject = "Real estate Inquiry";
//Put where to redirect to after sending the email
$redirect = "thank_you.html";
// ************End Configure****************
foreach($HTTP_POST_VARS as $key => $value) {
$message .= $key . ': ' . $value;
$message .= "\n"; //Note the double quotes
}
if (@mail($mailto, $subject, $message)) {
header("Location: $redirect");
} else {
// This echo's the error message if the email did not send.
// You could change the text in between the <p> tags.
echo('<p>Mail could not be sent. Please use your back button to try again.</p>');
}
?> [code]
Thank you very much for any help.
Lauren