> From: "Scott Miller" <[EMAIL PROTECTED]> > > I have a current php script that allows me to add/remove customer information > from a particular MySQL Database. What I would like to do, is when an > employee adds a customer, have some (if not all) of that information e-mailed > to a particular e-mail address. > > I've created scripts that e-mail info, and ones that just enter info into a > database, but have not attempted combining them. > > Anyone have any ideas, or is anyone doing this? If so, could you give me a > quick how-to or point me in the direction of some online documentation? >
There's nothing tricky about it. Just do the database insert and then send the email. I suggest returning a simple success/failure from the database insert so that if it fails you can note that in the email (probably going to a site administrator). I build strings for $subject, $headers and $message (from the values that were used in the insert) like so: $message = "SUBMITTED:\n\n"; $message .= "First name: $first\n"; $message .= "Last name: $last\n\n"; $message .= "Address: $address1\n"; if ($address2 != "") { $message .= "Address: $address2\n"; } etc. Then send it and report failure or success to the user like so: if ([EMAIL PROTECTED]("$send_to_name<$sendto>", $subject, $message, $headers)) { // report failure to send confirming email } else { // thanks for submitting } HTH -- Lowell Allen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php