Title: Form Fields
Last modified: December 7, 2016

---

# Form Fields

 *  [moni](https://wordpress.org/support/users/muneeba/)
 * (@muneeba)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/form-fields-9/)
 * Hi.
    I am using this plugin in site and made custom fields to post like {$form_data-
   >posted_data[‘select-family’]} {$form_data->posted_data[‘translator’]} the language
   is{$form_data->posted_data[‘select-language’]} I made another form which do not
   include these fields when I submit that form the the helping text like “the language
   is” also showing. How to solve this?
    -  This topic was modified 9 years, 6 months ago by [moni](https://wordpress.org/support/users/muneeba/).

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

 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/form-fields-9/#post-8529168)
 * Options:
 * (1) The code should only run for a specific form if you set it up like the example
   `
   if ($form_data->title = $form_title) ...` So you could set up different filter
   functions for different forms
 * (2) Or you can use the same filter function for multiple forms, but add “if” 
   statements based on what fields are submitted. For example:
 *     ```
       $content = '';
       if (isset($form_data->posted_data['select-family']) {
         $content .= $form_data->posted_data[‘select-family’] . ' ';
       }
       if (isset($form_data->posted_data['translator']) {
         $content .= $form_data->posted_data[‘translator’] . ' ';
       }
       if (isset($form_data->posted_data['select-language']) {
         $content .= "the language is {$form_data->posted_data[‘select-language’]}";
       }
       $form_data->posted_data['post_content'] = $content;
   
       $form_data->posted_data['post_content'] =
                   "This is a post from {$form_data->posted_data['your-name']} with email {$form_data->posted_data['your-email']}";
       ```
   
    -  This reply was modified 9 years, 6 months ago by [Michael Simpson](https://wordpress.org/support/users/msimpson/).
 *  Thread Starter [moni](https://wordpress.org/support/users/muneeba/)
 * (@muneeba)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/form-fields-9/#post-8530992)
 * Thank you for reply
    I made different forms and by setting form title in which
   this code is common: “This is a post from {$form_data->posted_data[‘your-name’]}
   with email {$form_data->posted_data[‘your-email’]} {$form_data->posted_data[‘
   select-family’]} {$form_data->posted_data[‘translator’]} the language is{$form_data-
   >posted_data[‘select-language’]} {$form_data->posted_data[‘Urgent-Service’]} 
   on date{$form_data->posted_data[‘your-date’]}
 * Now i added more content after this code in different form like
 * for {$form_data->posted_data[‘picnic-planning’]}
 *  now post is not showing content after date. the post data code is same in form
   and in function. The post is like this:
 * This is a post from julia with email [test@test.com](https://wordpress.org/support/topic/form-fields-9/test@test.com?output_format=md)
   
   Family A Translator Required the language isChinese Urgent Service Not Require
   on date for Array
 * Not showing content after date form my multiple forms.
 *  Thread Starter [moni](https://wordpress.org/support/users/muneeba/)
 * (@muneeba)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/form-fields-9/#post-8531165)
 * By activating code for other forms the post does not show the content written
   after common content of all forms.
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/form-fields-9/#post-8531322)
 * It sounds like you just need to debug your own code.
 *  Thread Starter [moni](https://wordpress.org/support/users/muneeba/)
 * (@muneeba)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/form-fields-9/#post-8535658)
 * I wrote code for different form with different function names. I am using shortcode,
   action filters.
    The code works perfectly if other forms code is deactivated 
   and stop working when all forms code activated. I tried by changing name of post
   field code for example: destination to t-destination to differentiate it from
   other fields but still nothing happen when code is activated for all forms. If
   you understand this problem then guide me please.
 * By trying second method Now I write code , to work for multiple forms.But it 
   is generating error not working.Please check am I writing in right way.. Error
   is generated at line 7.
 *  function f2p_consolidate_fields( $form_data ) { // change the function name 
   as needed
    $form_title = ‘Help Form’; // Change this to your form name if ($form_data-
   >title = $form_title) { // Next line sets the post_title value $form_data->posted_data[‘
   post_title’] = “Post from {$form_data->posted_data[‘your-name’]}”; $content =”;
   if (isset($form_data->posted_data[‘transport_service’]) { $content .= $form_data-
   >posted_data[‘transport_service’] . ‘ ‘; } if (isset($form_data->posted_data[‘
   Destination’]) { $content .= “for {$form_data->posted_data[‘Destination’] }”;}
   if (isset($form_data->posted_data[‘pickup-address’]) { $content .= “pickup address
   is {$form_data->posted_data[‘pickup-address’]}”; } if (isset($form_data->posted_data[‘
   pickup-city’]) { $content .= “from city {$form_data->posted_data[‘pickup-city’]}”;}
   if (isset($form_data->posted_data[‘pickup-state’]) { $content .= “state is {$
   form_data->posted_data[‘pickup-state’]}”; }
 *  $form_data->posted_data[‘post_content’] = $content;
 *  // Next line sets the post_content value
    $form_data->posted_data[‘post_content’]
   = “This is a post from {$form_data->posted_data[‘your-name’]} with email {$form_data-
   >posted_data[‘your-email’]} {$form_data->posted_data[‘select-family’]} {$form_data-
   >posted_data[‘translator’]} the language is{$form_data->posted_data[‘select-language’]}{
   $form_data->posted_data[‘Urgent-Service’]} on date{$form_data->posted_data[‘your-
   date’]}
 *  “;
    } return $form_data; } add_filter( ‘form_to_post_form_data’, ‘f2p_consolidate_fields’,
   10, 1 ); // make sure the function name matches above
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/form-fields-9/#post-8538693)
 * Post your code in [http://phpcodechecker.com/](http://phpcodechecker.com/)
 *  Thread Starter [moni](https://wordpress.org/support/users/muneeba/)
 * (@muneeba)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/form-fields-9/#post-8544481)
 * Hi.
    First of all thank you so much for support. I almost figure out problem..
   I have multiple forms I used this method for posting of multiple forms. if ($
   form_data->title = $form_title) … When there are multiple forms some thing in
   checkbox inside posting code it does not post. I used select boxes it started
   posting. There is some problem in plugin when posting with checkbox having multiple
   forms it does not work. Please have a look on that.
    -  This reply was modified 9 years, 6 months ago by [moni](https://wordpress.org/support/users/muneeba/).
 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/form-fields-9/#post-8544629)
 * I would need a complete example including form definition and hook code to reproduce
   the problem.

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

The topic ‘Form Fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/form-to-post.svg)
 * [Form to Post](https://wordpress.org/plugins/form-to-post/)
 * [Support Threads](https://wordpress.org/support/plugin/form-to-post/)
 * [Active Topics](https://wordpress.org/support/plugin/form-to-post/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/form-to-post/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/form-to-post/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/form-fields-9/#post-8544629)
 * Status: not resolved