Title: Database Table Entries
Last modified: May 7, 2026

---

# Database Table Entries

 *  [msslrb](https://wordpress.org/support/users/msslrb/)
 * (@msslrb)
 * [1 day, 13 hours ago](https://wordpress.org/support/topic/database-table-entries/)
 * Hi. I’m having an issue with sending form data to a custom database table. I 
   believe it’s an issue with address because that field returns blank when debugging
   even when i enter it. I have 2 separate db tables for 1 form. The petitions table
   shows blank for first_name last_name credentials email phone p_name and p_address.
   The concerns table doesn’t show a row at all after submissions. Can you help 
   with this code? Thanks
 *     ```wp-block-code
       // INSERT INTO MAIN PETITIONS TABLE     $wpdb->insert(         $wpdb->prefix . 'petitions',         [             'form_id'          => $form_id,             'submission_id'    => $entry_id,             'first_name'       => sanitize_text_field($data['first_name'] ?? ''),             'last_name'        => sanitize_text_field($data['last_name'] ?? ''),             'credentials'      => sanitize_text_field($data['credentials'] ?? ''),             'email'            => sanitize_email($data['email'] ?? ''),             'phone'            => sanitize_text_field($data['phone'] ?? ''),             'p_name'    => sanitize_text_field($data['p_name'] ?? ''),             'p_address' => sanitize_text_field($data['p_address'] ?? ''),             'created_at'       => current_time('mysql')         ]     );     $petition_row_id = $wpdb->insert_id;     // INSERT INTO CONCERNS TABLE     if ($petition_row_id) {         $concerns_table = $wpdb->prefix . 'petition_concerns';        foreach ($data as $key => $value) {            if (strpos($key, 'concern_') === 0 && !empty($value)) {                $wpdb->insert($concerns_table, [                    'petition_id'   => $petition_row_id,                    'concern_group' => $key,                    'concern_value' => sanitize_text_field($value),                    'created_at'    => current_time('mysql')                ]);            }        }     }    // 3. Handle Transient for redirect pages    $petitions = get_posts([         'post_type'   => 'petition',         'numberposts' => 1,         'meta_query'  => [['key' => '_form_id', 'value' => $form_id]]     ]);     if (!empty($petitions)) {        $petition_post_id = $petitions[0]->ID;         set_transient('petition_last_entry_' . $petition_post_id, $entry_id, 10 * MINUTE_IN_SECONDS);     }} 
       ```
   

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

 *  Thread Starter [msslrb](https://wordpress.org/support/users/msslrb/)
 * (@msslrb)
 * [1 day, 6 hours ago](https://wordpress.org/support/topic/database-table-entries/#post-18902273)
 * Sorry, I accidentally eft the important part out. I’m not sure if I’m using deprecated
   hooks or if it’s an address issue.
 *     ```wp-block-code
       // 1. Capture the Entry IDadd_action( 'forminator_custom_form_submit_before_set_fields', function( $entry, $form_id, $field_data_array ) {    $_POST['actual_submission_id'] = $entry->entry_id;}, 20, 3 );// 2. Hook into submissionadd_action('forminator_form_after_save_entry', 'process_petition_submission', 10, 2);add_action('forminator_form_after_handle_submit', 'process_petition_submission', 10, 2);function process_petition_submission($form_id, $response) {     $entry_id = isset($_POST['actual_submission_id']) ? absint($_POST['actual_submission_id']) : 0;    if (!$entry_id && isset($response['entry_id'])) $entry_id = absint($response['entry_id']);    if (!$entry_id) return;    global $wpdb;     if (!class_exists('Forminator_API')) return;     $entry = Forminator_API::get_entry((int)$form_id, (int)$entry_id);     if (is_wp_error($entry) || !$entry) return;     $data = [];    foreach ($entry->meta_data as $field) {        $slug  = $field['name'] ?? '';        $value = $field['value'] ?? '';        if (!$slug) continue;        if (is_array($value)) {            $value = implode(', ', array_filter($value));        }        $data[$slug] = $value;    }// INSERT INTO MAIN PETITIONS TABLE     $wpdb->insert(         $wpdb->prefix . 'petitions',         [             'form_id'          => $form_id,             'submission_id'    => $entry_id,             'first_name'       => sanitize_text_field($data['first_name'] ?? ''),             'last_name'        => sanitize_text_field($data['last_name'] ?? ''),             'credentials'      => sanitize_text_field($data['credentials'] ?? ''),             'email'            => sanitize_email($data['email'] ?? ''),             'phone'            => sanitize_text_field($data['phone'] ?? ''),             'p_name'    => sanitize_text_field($data['p_name'] ?? ''),             'p_address' => sanitize_text_field($data['p_address'] ?? ''),             'created_at'       => current_time('mysql')         ]     );     $petition_row_id = $wpdb->insert_id;     // INSERT INTO CONCERNS TABLE     if ($petition_row_id) {         $concerns_table = $wpdb->prefix . 'petition_concerns';        foreach ($data as $key => $value) {            if (strpos($key, 'concern_') === 0 && !empty($value)) {                $wpdb->insert($concerns_table, [                    'petition_id'   => $petition_row_id,                    'concern_group' => $key,                    'concern_value' => sanitize_text_field($value),                    'created_at'    => current_time('mysql')                ]);            }        }     }    // 3. Handle Transient for redirect pages    $petitions = get_posts([         'post_type'   => 'petition',         'numberposts' => 1,         'meta_query'  => [['key' => '_form_id', 'value' => $form_id]]     ]);     if (!empty($petitions)) {        $petition_post_id = $petitions[0]->ID;         set_transient('petition_last_entry_' . $petition_post_id, $entry_id, 10 * MINUTE_IN_SECONDS);     }} 
       ```
   
 *  Plugin Support [Nebu John – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport14/)
 * (@wpmudevsupport14)
 * [23 hours, 54 minutes ago](https://wordpress.org/support/topic/database-table-entries/#post-18902399)
 * Hi [@msslrb](https://wordpress.org/support/users/msslrb/),
 * Trust you are doing well, and thank you for reaching out to us.
 * I have pinged our development team to check if the hooks used in your code are
   valid, and we’ll update you here once we have more feedback on this as soon as
   possible.
 * However, please note that custom codes are out of the scope of the general support
   we provide here. You need to hire a developer if it is required to validate the
   code.
 * That being said, can you please also share an export of the form so that we can
   take a closer look at this and see if we can help you with some feedback? Please
   share the form export using Google Drive or Pastebin.com.
 * I hope the following guide comes in handy: [https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export](https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export)
 * Looking forward to hearing back from you.
 * Best Regards,
    Nebu John
 *  Plugin Support [Nebu John – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport14/)
 * (@wpmudevsupport14)
 * [23 hours, 43 minutes ago](https://wordpress.org/support/topic/database-table-entries/#post-18902414)
 * Hi [@msslrb](https://wordpress.org/support/users/msslrb/),
 * We have a confirmation from our development team, the hooks that have been used
   in your code are valid.
 * Please share an export of the form so that we can take a look at this further
   and see if we can share some insights.
 * Best Regards,
    Nebu John
 *  Thread Starter [msslrb](https://wordpress.org/support/users/msslrb/)
 * (@msslrb)
 * [22 hours, 31 minutes ago](https://wordpress.org/support/topic/database-table-entries/#post-18902495)
 * Thank you! I’ve shared the form export file and main code file.
 * [https://drive.google.com/file/d/1g7tOxBxC5NTXE-qPJVOlsxrhGOC16_Gt/view?usp=drive_link](https://drive.google.com/file/d/1g7tOxBxC5NTXE-qPJVOlsxrhGOC16_Gt/view?usp=drive_link)
 * [https://drive.google.com/file/d/13qK8qRUyrhnYJr15fX1KSjAIaiRRqDWa/view?usp=sharing](https://drive.google.com/file/d/13qK8qRUyrhnYJr15fX1KSjAIaiRRqDWa/view?usp=sharing)
 *  Plugin Support [Nithin – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport11/)
 * (@wpmudevsupport11)
 * [18 hours, 23 minutes ago](https://wordpress.org/support/topic/database-table-entries/#post-18902698)
 * Hi [@msslrb](https://wordpress.org/support/users/msslrb/),
 * In the given code, the petition_install_tables() function has a nested function
   definition and never actually runs dbDelta(). Is that expected?
 * Also, foreach ($entry->meta_data as $field) is using the wrong structure; in 
   Forminator, $entry->meta_data is almost always an associative array.
 * Please do note that providing custom code is outside our support scope. For that,
   you’ll need to hire a developer to provide the required custom code for you. 
   WordPress provides a jobs directory here [https://jobs.wordpress.net/](https://jobs.wordpress.net/)
 * If you need further advice about it, feel free to email us at [wpsupport@incsub.com](https://wordpress.org/support/topic/database-table-entries/wpsupport@incsub.com?output_format=md)
   using the following subject.
 * “Subject: ATTN: WPMU DEV support – wp.org”
 * Regards,
 * Nithin

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

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fdatabase-table-entries%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Nithin – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport11/)
 * Last activity: [18 hours, 23 minutes ago](https://wordpress.org/support/topic/database-table-entries/#post-18902698)
 * Status: not resolved