Title: Format to insert data
Last modified: May 16, 2023

---

# Format to insert data

 *  Resolved [Degas](https://wordpress.org/support/users/degas/)
 * (@degas)
 * [3 years ago](https://wordpress.org/support/topic/format-to-insert-data/)
 * Hi, thanks for this plugin. We have a couple of issues with our form, wondering
   if these can be addressed within CF7 or need addressing elsewhere.
    1. Looking to import a string variable into a database meta field that expects 
       the format a:1:{i:0;s:8:”12345678″;} where 12345678 is the variable.
       Including
       the variable in a string to match the above adds s25 and quotes when the data
       is inserted into the database, ie s:25:”a:1:{i:0;s:8:”63028828″;}”; which is
       then unrecognised by the page requiring this data.Applying json encode to the
       data gives us “a:1:{i:0;s:8:”12345678″;}”, again the quotes prevent the data
       from being read.How might we pull through our core string as intended without
       it being wrapped?
    2. We’d like the Select option values to pull through differently from their labels,
       ie a ’20 images’ label pulls through 20 as the value. Inital tests using pipes
       haven’t worked, is there anywhere within Post My CF7 Form that addresses this?
 * Thanks for any help, excuse me if I’ve missed anything obvious.

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

 *  Thread Starter [Degas](https://wordpress.org/support/users/degas/)
 * (@degas)
 * [3 years ago](https://wordpress.org/support/topic/format-to-insert-data/#post-16753459)
 * Quick FYI, have solved Q2 with the solution from [https://wordpress.org/support/topic/select-with-pipes/](https://wordpress.org/support/topic/select-with-pipes/).
 * Currently still stuck on Q1, any help much appreciated.
 *  Thread Starter [Degas](https://wordpress.org/support/users/degas/)
 * (@degas)
 * [3 years ago](https://wordpress.org/support/topic/format-to-insert-data/#post-16758373)
 * Finally solved Q1 (and learnt about serialized data). My solution was to add 
   an action (as per 3.6 in Hooks & Filters to customise the mapping) with a function
   to unserialize the submitted data as all forms of data manipulation tried had
   simply resulted in unchanged or reserialized data
 * add_action(‘cf7_2_post_form_submitted_to_clientspage’, ‘new_clientspage_mapped’,
   1000, 4); // changed priority from 10 to 1000
   /**
 * * Function to take further action once form has been submitted and saved as a
   post. Note this action is only fired for submission which has been submitted 
   as opposed to saved as drafts.
   * [@param](https://wordpress.org/support/users/param/)
   string $post_id new post ID to which submission was saved.* [@param](https://wordpress.org/support/users/param/)
   array $cf7_form_data complete set of data submitted in the form as an array of
   field-name=>value pairs.* [@param](https://wordpress.org/support/users/param/)
   string $cf7form_key unique key to identify your form.* [@param](https://wordpress.org/support/users/param/)
   array $submitted_files array of files submitted in the form, if any file fields
   are present.*/function new_clientspage_mapped($post_id, $cf7_form_data, $cf7form_key,
   $submitted_files){//do something. $user_array = get_post_meta($post_id,’user_ids’,
   true);$user_array = unserialize( $user_array ); update_post_meta($post_id,’user_ids’,
   $user_array);}
 * Hope this helps someone 🙂
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/format-to-insert-data/#post-16779244)
 * well done, glad you figured it out. Please use `<code>` markup for your code 
   example so that it is more legible.
 *  Plugin Author [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * (@aurovrata)
 * [2 years, 12 months ago](https://wordpress.org/support/topic/format-to-insert-data/#post-16779312)
 * > thanks for this plugin
 * wc, please leave a [review](https://wordpress.org/support/plugin/post-my-contact-form-7/reviews/)
   when you have a moment to spare.

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

The topic ‘Format to insert data’ is closed to new replies.

 * ![](https://ps.w.org/post-my-contact-form-7/assets/icon-256x256.png?rev=1985682)
 * [Post My CF7 Form](https://wordpress.org/plugins/post-my-contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/post-my-contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/post-my-contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/post-my-contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/post-my-contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/post-my-contact-form-7/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Aurovrata Venet](https://wordpress.org/support/users/aurovrata/)
 * Last activity: [2 years, 12 months ago](https://wordpress.org/support/topic/format-to-insert-data/#post-16779312)
 * Status: resolved