On Create, Server Side, Email
On Create, Server Side, Email
Hello Allan or anyone else who would like to offer any hints.
Keep in mind my question is not about emailing as I believe that goes beyond the scope of datatables. My question to is something simple. I don't have any code yet written, but I am just wondering how I can get all the pieces together.
I have a datatable that does capture data which I am using, but what I want to do is once it creates the new entry into the database if there is some sort of event within php like OnCreated or something like that which I can use to see what data was saved. From there I would like to use a PHP Email Client and send off a notification about that new entry.
Maybe like a flowchart can help to illustrate what I want to do.
Client Side
User clicks "Add" within the Editor and types in all the necessary content. Then clicks "Create".
Server Side
Once the data has been stored find out what was just stored and send an email with that information to a user.
Is there an event or maybe a way I can get the last entry saved? Or maybe something close to that?
Hopefully this is making sense on what I want to do. Again, I am not asking how to email, but rather how do I obtain the last saved entry? From there I can figure out how to send an email within PHP.
Thank you!
This question has accepted answers - jump to:
Answers
Use a postCreate() function.
https://editor.datatables.net/reference/event/postCreate
Yes indeed there is. The events triggered by the PHP libraries for Editor are detailed here.
I also wrote a blog post about the server-side events when they were introduced, which includes an example showing how to send e-mail notifications when the actions happen.
Regards,
Allan
Thank you both of you! You're advice was very helpful!