Support » Plugin: Easy Registration Forms » Inserting data to different database table after submission

  • Resolved jerrelzendos

    (@jerrelzendos)


    Hi there!

    First of all, great plugin.

    Can you tell me how I can insert the submission data into my database? If found the hook for this in an other topic, but I’m not sure how to retract the data from the ‘$submission’ variable.

    If have multiple fields like name, emailadres and password. How can I retract these field values from the ‘$submission’ variable?

    Thanks!

    add_action(‘erf_post_submission’,’after_submission_callback’);
    function after_submission_callback($submission){
    //Custom Logic
    }

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author easyregistrationforms

    (@easyregistrationforms)

    Hi @jerrelzendos,

    Thank you for contacting us. $submission is just an ordinary array. You can dump it and check all the available data. Password field won’t be part of it as it is saved into WordPress user table in encrypted format. We do not save password in separate table to make sure the integrity.

    Let me know if you have further queries.

    jerrelzendos

    (@jerrelzendos)

    Hi there,

    Thanks for your response. I’ve inserted the $submission array through the PHP impode() function but I don’t see any field values:

    Array,13447,13307,15-02-2019 9:33 am,15-02-2019 9:33 am,0

    For example, some of my fields are: firstname, e-mailadres en date of birth.

    Any idea why I don’t see these fields in the array?

    Thanks

    Plugin Author easyregistrationforms

    (@easyregistrationforms)

    Hi @jerrelzendos,

    $submission is a nested array. You don’t have to implode $submission. I would suggest you to understand the array structure using var_dump. Then you will be able to extract the required information. For example: All the field’s data are saved under “fields_data” key which again points to a nested array with all the field referenced and their corresponding values.

    jerrelzendos

    (@jerrelzendos)

    Hi,

    Thanks again for your response.

    If it’s not too complicated, can you tell how to use var_dump to show the array? When I echo var_dump($submission) in the function, nothing is shown after I submit my form.

    Thanks again!

    Plugin Author easyregistrationforms

    (@easyregistrationforms)

    Hi,

    Our plugin uses AJAX to send submission request. Hence it will not output the data into browser. You will have to use browser’s XHR console to check the printed data. I would prefer to use “die” statement to stop the execution. Php code is:
    var_dump($submission);
    die;

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.