Title: Saving custom wordpress form data into database
Last modified: January 26, 2020

---

# Saving custom wordpress form data into database

 *  Resolved [bahadweikat](https://wordpress.org/support/users/bahadweikat/)
 * (@bahadweikat)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/saving-custom-wordpress-form-data-into-database-2/)
 * Hi,
    i have created form (“Name form”) using fluent form in wordpress and then
   i have used this form in a page (“Name Page”). The form has two text box (“first
   name”) and (“last name”). in the sql database (cpanel) i have also created table
   with same structure (“fname” as a varchar) and (“lname” as a varchar).
 * now when i load the page (“Name Page”) the form loaded perfectly. but i want 
   to store the values for both into the database once i click submit button.
 * i tried to write php file , but it didnt work. i didnt know how to get the value
   of the text boxes from the form and pass them to the database. i also didnt know
   how to call the php file and where shall i put the file under which folder in
   the server.
 * i have been looking for solution for more than a week and searching everywhere
   to find simple and detailed solution step by step how to do that without any 
   luck? please help me.

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

 *  Plugin Author [Shahjahan Jewel](https://wordpress.org/support/users/techjewel/)
 * (@techjewel)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/saving-custom-wordpress-form-data-into-database-2/#post-12367424)
 * Hello [@bahadweikat](https://wordpress.org/support/users/bahadweikat/)
    You have
   to use a submission action. Here is the in details docs: [https://wpfluentforms.com/docs/submission-lifecycle/](https://wpfluentforms.com/docs/submission-lifecycle/)
 * Basically you have to use fluentform_submission_inserted action hook.
 * Please check this documentation:
    [https://wpfluentforms.com/docs/fluentform_submission_inserted/](https://wpfluentforms.com/docs/fluentform_submission_inserted/)
 *     ```
       add_action('fluentform_submission_inserted', 'your_custom_after_submission_function', 20, 3);
   
       function your_custom_after_submission_function($entryId, $formData, $form)
       {
         if($form->id != 5) {
             return;
          }
          // DO your stuffs here
       }
       ```
   
 * Thanks
 *  Thread Starter [bahadweikat](https://wordpress.org/support/users/bahadweikat/)
 * (@bahadweikat)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/saving-custom-wordpress-form-data-into-database-2/#post-12374632)
 * thank you [@techjewel](https://wordpress.org/support/users/techjewel/)
 * i looked on the documentation and i used the following code inside function.php
   file :
 *     ```
       add_action('fluentform_submission_inserted', 'your_custom_after_submission_function', 20, 3);
   
       function your_custom_after_submission_function($entryId, $formData, $form)
       {
         if($form->id != 5) {
             return;
          }
   
          global $wpdb;
   
       	if (isset($_POST['submitbtn'])) {
       		global $wpdb;
       		$GText = $_POST['input_text'];
       		$wpdb->insert('sg_AdminPage',array('GymName'=>$Gtext));
               echo "record inserted";
       	}
   
       }
       ```
   
 * i have created blank form in fluentforms contains only text input with name attribute
   is “input_text” and submit button (the default one), on submission the form is
   submitted without inserting the value of the text input inside the db. where 
   is the mistake i did ?
    can you please help
    -  This reply was modified 6 years, 4 months ago by [bahadweikat](https://wordpress.org/support/users/bahadweikat/).
 *  Thread Starter [bahadweikat](https://wordpress.org/support/users/bahadweikat/)
 * (@bahadweikat)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/saving-custom-wordpress-form-data-into-database-2/#post-12374636)
 * it looks like the code ends when it goes inside the if statement ` if($form->
   id != 5) {
    return; }
 *  Thread Starter [bahadweikat](https://wordpress.org/support/users/bahadweikat/)
 * (@bahadweikat)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/saving-custom-wordpress-form-data-into-database-2/#post-12374641)
 * i tried to put simple code after the word return like this :
 *     ```
        if($form->id != 5) {
            echo "test";     
            return; 
          }
       ```
   
 * but on submission the form keep loading
 *  Plugin Author [Shahjahan Jewel](https://wordpress.org/support/users/techjewel/)
 * (@techjewel)
 * [6 years, 4 months ago](https://wordpress.org/support/topic/saving-custom-wordpress-form-data-into-database-2/#post-12400446)
 * It will keep loading because your are echo something which is invaliding the 
   response json.
    Again, Please check the available hooks on form submission here:
 * [https://wpfluentforms.com/docs/submission-lifecycle/](https://wpfluentforms.com/docs/submission-lifecycle/)

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

The topic ‘Saving custom wordpress form data into database’ is closed to new replies.

 * ![](https://ps.w.org/fluentform/assets/icon-256x256.png?rev=3354580)
 * [Fluent Forms – Customizable Contact Forms, Survey, Quiz, & Conversational Form Builder](https://wordpress.org/plugins/fluentform/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/fluentform/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/fluentform/)
 * [Active Topics](https://wordpress.org/support/plugin/fluentform/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/fluentform/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/fluentform/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Shahjahan Jewel](https://wordpress.org/support/users/techjewel/)
 * Last activity: [6 years, 4 months ago](https://wordpress.org/support/topic/saving-custom-wordpress-form-data-into-database-2/#post-12400446)
 * Status: resolved