Hello Abu, I wonder if it's possible to view the insert code for the add new record form? When I add a new record I think it would be great to be able to autosend an html email to the user with forms details in body? I've done this before but not use g phpgrid?
You can do it using on_insert event handler.
It basically inject your custom code before the insert operation of grid.
You can also use on_after_insert.
Complete options and sample code can be checked in demos/editing/custom-events.php
Hi Abu, again thank you. Do you have any demos or code to achieve this at all? I have the below code which sends an email from my hosting but no idea how to pull the grid form data through and add to insert code of gridfrom?
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "[email protected]";
$to = "[col: email]";
$subject = "PHP Mail Test script";
$message = "All phpgrid fields here";
$headers = "From:" . $from;
echo "Test email sent";
Thank you very much sure it would be useful demo for us staters 🙂
Here is sample code:
This is not tested. It is just to give an idea how to use on_insert event and it's data.
Please email me your code. i'll integrate it to help your understand. You can email me at [email protected]
Btw, the comments in the hastebin link were not be uncommented. It was written:
"These comments are just to show the input param format"
Hi Abu, much appreciated & I know it was untested so no problems. As a test I have added the code to a working grid, once I remove the comments it starts to throw errors on line $data => Array as below.
If I change to == it then passes that line but errors on all lines below, looking at the custom vents demo that code seems fine so I must be looking in the wrong place, is $data => Array the correct code?
$data => Array
[params] => Array
[name] => Test
[gender] => male
[company] => Comp
$msg = "";
If any of the users who have purchased read this and indeed have a working example I would very much appreciate the assistance, this is a key function in my project to have clients emailed on insert?
Thank you so much
We are sorry that this post was not useful for you!
Let us improve this post!
Tell us how we can improve this post?