Title: Saving token values to database
Last modified: August 22, 2016

---

# Saving token values to database

 *  [edloz](https://wordpress.org/support/users/edloz/)
 * (@edloz)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/saving-token-values-to-database/)
 * I have been using your plugin for about 2 weeks and as I have told you before,
   I absolutely love it!
 * I am trying to see how I could store the values from tokens such as: {__platform},{
   __useragent}, etc. in the database.
 * The values are sent ok with the notify administrator email, but I would like 
   them to also be stored in the database along with the other fields.
 * What I have tried to do is to make hidden fields and when creating the fields,
   I have placed the token, such as {__platform} in the Default values and Allowed
   values fields. I have tried it with and without a label. I have also tried putting
   the token only in the Default values field, only in the Allowed values field 
   and in both. I have added the hidden field to the Form in the hopes that it will
   capture the value of the token and write it to the database, but when I look 
   in the Submissions page, all that shows up is the literal token, such as {__platform},
   but not the value.
 * Is the plugin capable of doing this at this time? If so, please tell me what 
   would I need to do.
 * Thanks again for writing the best Contact Form plugin in all of wordpress.
 * [https://wordpress.org/plugins/contact-forms/](https://wordpress.org/plugins/contact-forms/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [cimatti](https://wordpress.org/support/users/cimatti/)
 * (@cimatti)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/saving-token-values-to-database/#post-5782847)
 * Hi, thanks again 🙂
 * These informations are actually saved in column afs_stats of table accua_forms_submissions
   in JSON format
 * I didn’t show these information in the Submissions table because I thought they
   were useful only for debug. If you just want to see them in this table and in
   the exported file I may add them in a future release.
 * If you really want to save these information in a field during submission, you
   can create a plugin that implements the filter “accua_forms_submission”, and 
   in the filter you may get ‘__subid’, ‘__platform’, ‘__user_agent’ from array 
   $replace_map (the first parameter of this filter, that must be returned at the
   end) and then save the extra field with something like
 *     ```
       $wpdb->insert(
         $wpdb->prefix . 'accua_forms_submissions_values',
         array (
           'afsv_sub_id' => $replace_map['__subid'],
           'afsv_field_id' => 'platform',
           'afsv_type' => 'hidden',
           'afsv_value' => $replace_map['__platform'],
         ),
         array('%d','%s','%s','%s')
       );
       ```
   
 *  Thread Starter [edloz](https://wordpress.org/support/users/edloz/)
 * (@edloz)
 * [11 years, 3 months ago](https://wordpress.org/support/topic/saving-token-values-to-database/#post-5782875)
 * Thank you for your answer and I appreciate it.
 * However, my PHP knowledge is very limited and I have no idea what you said. It
   was like Chinese to me LOL. I will be taking a programming course and perhaps
   after that I can understand your answer. I do appreciate your answering my question
   very much, but you will probably come out with an update that implements it faster
   than I will get to the point where I can understand it. And it’s good that it’s
   there, so I can take a look at it again when I learn some more.
 * If you could add them in a future release, I would really appreciate it.
 * Thanks again.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Saving token values to database’ is closed to new replies.

 * ![](https://ps.w.org/contact-forms/assets/icon.svg?rev=2947119)
 * [Contact Forms by Cimatti](https://wordpress.org/plugins/contact-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-forms/reviews/)

## Tags

 * [hidden fields](https://wordpress.org/support/topic-tag/hidden-fields/)

 * 2 replies
 * 2 participants
 * Last reply from: [edloz](https://wordpress.org/support/users/edloz/)
 * Last activity: [11 years, 3 months ago](https://wordpress.org/support/topic/saving-token-values-to-database/#post-5782875)
 * Status: not resolved