Title: Adding Form Data before it is saved
Last modified: August 31, 2016

---

# Adding Form Data before it is saved

 *  Resolved [tbw75](https://wordpress.org/support/users/tbw75/)
 * (@tbw75)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/adding-form-data-before-it-is-saved-1/)
 * I am trying to make the filter shown on “[http://cfdbplugin.com/?page_id=747&#8221](http://cfdbplugin.com/?page_id=747&#8221);
   work for my website.
 * Here’s the background:  I’m using Fast Secure Contact Form.  I’ve named my form
   label as “register”.  The FSCF plugin tells me that the shortcode is [si-contact-
   form form=’3′] but in order to make my form appear on a page I needed to use [
   si-contact-form form=”3″]
    A very minor point, but I’m a beginner and I only 
   raise this slight difference in case a similar issue might be causing the problem
   below.
 * I have set up a hidden field on the FSCF called “Passcode” which I would eventually
   like to use as a unique identifier, but at this stage I am simply trying to make
   any value pass through to the Passcode column of my database.
 * I have the Contact Form to DB extension.   The form works fine, it submits values
   to each of the other fields of the CFDB. The Passcode column-header is present
   on the CFDB and, as expected, at this stage there are no values within the column
   because it is a hidden field.
 * Next I installed Shortcodes, Actions and Filters with the intention of adding
   a filter to create a Passcode which will be submitted to the database.  I have
   added the code shown below, and it is activated.  For now you’ll see I have set
   the value of Passcode as a fixed value = 192 to test if the filter works but 
   no value is feeding into CFDB under the Passcode column.  Given the minor issue
   i mentioned above with ‘ and “, I have tried LOTS of different variations of 
   the following code but no success.  So any advice is gratefully received!
 * Within the code below I have also tried “form” instead of “title”.
 * I have also tried the form label “register” instead of the number “3”.
 * Having tried MANY slight tweaks to the shortcode it seems like I am missing something
   really simple?  As i mentioned, I am a beginner so I might be missing something
   more fundamental. I’ve named the filter shortcode create_uniqueID.  Do I need
   to enter the shortcode of the filter on a page maybe?  Or maybe I need to select
   a particular option within the shortcode “execute only for” dropdown list?
 * function myFilter($formData){
        $formName = ‘3’;     if ($formData && $formName
   == $formData->title) {         $formData->posted_data[‘Passcode’] = ‘192’;   }
   return $formData; }
 * add_filter(‘cfdb_form_data’, ‘myFilter’);
 * [https://wordpress.org/plugins/contact-form-7-to-database-extension/](https://wordpress.org/plugins/contact-form-7-to-database-extension/)

The topic ‘Adding Form Data before it is saved’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/contact-form-7-to-database-extension_ffffff.
   svg)
 * [Contact Form DB](https://wordpress.org/plugins/contact-form-7-to-database-extension/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7-to-database-extension/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7-to-database-extension/reviews/)

## Tags

 * [add](https://wordpress.org/support/topic-tag/add/)
 * [before](https://wordpress.org/support/topic-tag/before/)
 * [edit](https://wordpress.org/support/topic-tag/edit/)
 * [submission](https://wordpress.org/support/topic-tag/submission/)
 * [submit](https://wordpress.org/support/topic-tag/submit/)

 * 0 replies
 * 1 participant
 * Last reply from: [tbw75](https://wordpress.org/support/users/tbw75/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/adding-form-data-before-it-is-saved-1/)
 * Status: resolved