PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How to save data in the database by using the pre_submission_handler

  1. I am using the following hook for extracting the value of a field and i want to save the data for this field in the database.

    http://pastie.org/1620702

    Posted 13 years ago on Tuesday March 1, 2011 | Permalink
  2. Here is an example of the gform_pre_submission hook which shows changing a form field value, which then gets stored as that field value in the entry data.

    <?php
    
    add_action("gform_pre_submission", "pre_submission_handler");
    function pre_submission_handler($form){
        $_POST["input_14"] = "new value for field 14";
    }
    ?>

    This example would apply this change to ALL forms. Probably not what you want to do. You want to specify a specific form id by appending it to gform_pre_submission like so:

    <?php
    
    add_action("gform_pre_submission_5", "pre_submission_handler");
    function pre_submission_handler($form){
        $_POST["input_14"] = "new value for field 14";
    }
    ?>

    Notice the _5 in the gform_pre_submission action call above. This it the form id the code will be applied to.

    The example above shows how to change an input value. Doing the above would change it's value and it would then be stored in the entry table.

    Posted 13 years ago on Tuesday March 1, 2011 | Permalink
  3. Thank you so much Carl Hancock now every things is fine.

    Posted 13 years ago on Wednesday March 2, 2011 | Permalink

This topic has been resolved and has been closed to new replies.