Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP auto-email response question

Status
Not open for further replies.

Tread42

MIS
Feb 5, 2002
151
US
I'm new to the PHP realm. But I was wondering is there a function similar to the CDONTS function in ASP that will allow me to auto-email a forms responses or a database record fields upon completion of a form?

Regards
Tread42
 
$to="";
$subject="";
$message="";
mail($to,$subject,$message);
 
Hi,

// EMAIL FUNCTION
function send_mail($recipient, $subject, $email, $content) {
if (!$mu) {
mail($recipient, $subject, $content, "From: $email\n");
}
}

This uses an external file as a template for the autoresponder allowing variables to be read from the template file.

$recipient = etc.
$mail_en = file("mail_en.php");
$mail_en = join("", $mail_en);
eval("\$content_en =\"$mail_en\";");
$subject = "Your subject";
send_mail($email, stripslashes($subject), $recipient, stripslashes($content_en));

Gary
 
Thanks for all your help.

gcrighton-I've got one question, what does the stripslashes command do? When I'm trying to include the $phone for a phone number it's throwing the apache server for a loop because of entering "-" does this strip that out? If not, how can I delete those out? Or is there a way to sidestep that?

Regards
Tread42
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top