How to pass editor values to a PHP script on PostCreate?

How to pass editor values to a PHP script on PostCreate?

bsukbsuk Posts: 92Questions: 26Answers: 2

I've attempted this, but the examples on this page only show how to create a PDO database entry:
https://editor.datatables.net/manual/php/events

I just want to pass the editor results to PHP so that I can have a PHP script send an Email with the values after a new row has been created.
Are there any examples of this? Or should I be using the client side PostCreate function? If so, I can't see a way of passing the variables out..

With my (bad) attempts at this, I seem to get closer before receiving the errors:
Notice: Array to string conversion
or if writing to a file to test:
"error":"You cannot serialize or unserialize PDO instances"

Any help or a nudge in the right direction would be much appreciated. Many thanks.

This question has accepted answers - jump to:

Answers

  • bsukbsuk Posts: 92Questions: 26Answers: 2
    Answer ✓

    Okay, I figured it out.
    Everything can be wrapped in a preCreate function:

    ->on( 'preCreate', function ( $editor, $id, $values ) 
    

    using

    $values['FieldName']
    
  • allanallan Posts: 61,880Questions: 1Answers: 10,139 Site admin
    Answer ✓

    Thanks for posting back - good to hear you've got a solution!

    Allan

This discussion has been closed.