athosflorides Posted November 2, 2005 Share Posted November 2, 2005 Hello there! I've been trying the last few dates to create a function that not only inserts a record into my database but also notifies the administrators with an e-mail that specific data have been inserted. This a request form for support. The user submits the form and the new entry goes to my database. In order to avoid checking the database all the time for new requests, I want that values inserted to be e-mailed to a list of recipients. Can someone provide me with some information please? Upto now i have it working fine BUT without the e-mail function. Thank you. Quote Link to comment Share on other sites More sharing options...
morpheus.100 Posted December 7, 2005 Share Posted December 7, 2005 Well after you insert the record use the mail() function. Browse the php manual or goto the Macromedia site and get the free php mail .mxp available. Quote Link to comment Share on other sites More sharing options...
obsidian Posted December 7, 2005 Share Posted December 7, 2005 [!--quoteo(post=314026:date=Nov 2 2005, 11:40 AM:name=athosflorides)--][div class=\'quotetop\']QUOTE(athosflorides @ Nov 2 2005, 11:40 AM) 314026[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hello there! I've been trying the last few dates to create a function that not only inserts a record into my database but also notifies the administrators with an e-mail that specific data have been inserted. This a request form for support. The user submits the form and the new entry goes to my database. In order to avoid checking the database all the time for new requests, I want that values inserted to be e-mailed to a list of recipients. Can someone provide me with some information please? Upto now i have it working fine BUT without the e-mail function. Thank you. the idea is to run a check to make sure that you are successfully inserting the record into the DB. if it is a success, then emal. so, you'd want to run something like this: <?php $sql = "INSERT INTO tablename VALUES ('', 'whatever')"; // this is your query if (mysql_query($sql)) // returns true if it's successful { $to = 'you@yourdomain.com'; $sub = "New DB entry"; $msg = "New entry has been entered, values are: "; // any message you want to send mail($to, $sub, $msg); } ?> that's really all ther is to it (with some modifications to fit your code, obviously). good luck! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.