What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Integrate with WP DB

    Asked by ellie123 on June 26, 2014 at 02:25 PM

    Hello - I am so frustrated and need help. I have read the webhooks docs a thousand times and just cannot understand what to do, it's like Greek to me.

    I need for my form data to be saved to my Wordpress database so I can access and use the data after it's submitted. (However, I do still need to figure out how I will know when the user has completed a form? But, I'll cross that bridge...)

    I have a dedicated server, I have all access to my site, I have my form completed, etc...I just need help setting this final piece up.

    Pls tell me, step by step (if at all possible) how to receive submissions to my MySQL database? 

    I appreciate ANY help at all....THANK YOU so so so much

    - Ellie

    P.S. Here is my Post Data (?) from my form. It's a pretty long form....http://awesomescreenshot.com/0dd31uc057

    Page URL:
    http://form.jotform.us/form/41686264528160

    integrate wp Submissions POST post data long form
  • Profile Image
    JotForm Support

    Answered by david on June 26, 2014 at 03:03 PM

    Hi,

    Here is our guide on how to use PHP to send submission data to your MySQL database:

    http://www.jotform.com/help/126-How-to-send-Submissions-to-Your-MySQL-Database-Using-PHP

    As this is a fairly technical task, give it a try, and if you have issues with the setup, please let us know and we will be happy to assist as much as we can.

    Thank you for using Jotform!

  • Profile Image

    Answered by ellie123 on June 26, 2014 at 03:38 PM

    hi there - this is the form that I am following...BUT, I am stuck at one part. I have created a new table in my DB. I have added all my columns (there's a friggin' ton of them) and I am ready for this next step, however since I have like 50+ columns isn't that going to make a big difference on this PHP form?

    For instance, there's only 8 or so fields shown here...but, I have 50+....so do I just replace those shown below with my fields?

    Just wanted to make sure.....thank you

     

    // search submission ID

    $query = "SELECT * FROM `table_name` WHERE `submission_id` = '$submission_id'";
    $sqlsearch = mysql_query($query);
    $resultcount = mysql_numrows($sqlsearch);

    if ($resultcount > 0) {
     
        mysql_query("UPDATE `table_name` SET 
                                    `name` = '$name',
                                    `email` = '$email',
                                    `phone` = '$phonenumber',
                                    `subject` = '$subject',
                                    `message` = '$message'        
                                 WHERE `submission_id` = '$submission_id'"
         or die(mysql_error());
        
    else {

        mysql_query("INSERT INTO `table_name` (submission_id, formID, IP, 
                                                                              name, email, phone, subject, message) 
                                   VALUES ('$submission_id', '$formID', '$ip', 
                                                     '$name', '$email', '$phonenumber', '$subject', '$message') "
        or die(mysql_error());  

    }
    ?>

  • Profile Image
    JotForm Support

    Answered by jonathan on June 26, 2014 at 04:35 PM

    Hi Ellie,

    The sample PHP script on the guide  has lesser field number because it was only a sample for the guide's demo form http://www.jotform.com/form/11814245193

     

    For instance, there's only 8 or so fields shown here...but, I have 50+....so do I just replace those shown below with my fields?

    Actually that is the correct process.

    You just need to match your own form's http://www.jotform.com/41686264528160 field names and PHP variables to the given sample script.

    // search submission ID

    $query = "SELECT * FROM `table_name` WHERE `submission_id` = '$submission_id'";
    $sqlsearch = mysql_query($query);
    $resultcount = mysql_numrows($sqlsearch);

    if ($resultcount > 0) {
     
        mysql_query("UPDATE `table_name` SET 
                                    `name` = '$name',
                                    `email` = '$email',
                                    `phone` = '$phonenumber',
                                    `subject` = '$subject',
                                    `message` = '$message'        
                                 WHERE `submission_id` = '$submission_id'"
         or die(mysql_error());
        
    else {

        mysql_query("INSERT INTO `table_name` (submission_id, formID, IP, 
                                                                              name, email, phone, subject, message) 
                                   VALUES ('$submission_id', '$formID', '$ip', 
                                                     '$name', '$email', '$phonenumber', '$subject', '$message') "
        or die(mysql_error());  

    }
    ?>

    To know the variable names and PHP codes 

    Set this URL as your Thank You URL
    http://www.jotform.com/show-post-data

    Enable Send Post Data,

    Fill your form and submit. 

    ---

    As our colleague David had already mentioned, this task will require a bit more advance knowledge on programming (PHP and database). I am not quite sure if you will be up to the task, but if I am to suggest, it will be more advantageous for you if you instead hire or get technical assistance on that part.

    Just the same, we will do our best here to guide you how this can be achieved.

    Hope this help. Please inform us if you encounter any difficulty populating the DB with the script.

    Thanks.

     

  • Profile Image

    Answered by ellie123 on June 26, 2014 at 05:46 PM

    Hey there - So, I thought I had everything setup correctly!

    My script page is here: http://www.siteformybiz.com/thankyouscript.php

    But after I submit my form, it shows me the actual script page...

    Can you tell me where I went wrong? I thought I followed the directions to a T...

    I feel like I am SOOOO Close! :)

    Here is a screenshot of what I see after I submit: http://siteformybiz.com/screen1.jpeg

     

     

     

  • Profile Image

    Answered by ellie123 on June 26, 2014 at 06:21 PM

    WAIT! I can confirm that my answers ARE going into my database table!

    So, I have done SOMETHING right...but, not sure what.

     

     

  • Profile Image
    JotForm Support

    Answered by david on June 26, 2014 at 06:23 PM

    Hi,

    It seems as though you have setup things almost the way you want on your end.  If you have any other specific issues with your form, we will be happy to look into them for you.

    Thank you for using Jotform!

  • Profile Image

    Answered by ellie123 on June 26, 2014 at 06:27 PM

    Here is my form: http://form.jotform.us/form/41767263673160?

    But, after submitting the user sees just a blank white page....so the data is getting to my db but 2 things.

    1) How will I know a user has submitted a form?

    2) What can I do so the user will see something other than a blank white page after pressing submit?

    (The thank you page script I'm using is the one you guys suggested) 

    If you can help me with these last 2 items I think I'll be all set!

    Thank you

  • Profile Image
    JotForm Support

    Answered by jonathan on June 26, 2014 at 07:16 PM

    Hi Ellie,

    1.) The submission Notification Email alert can do that. Also, you can check your form's submission data and there should be submission there.

     

    2.) Since your PHP thank you script is server-side, we will not able to see the actual codes/script. I suggest you paste the PHP thank you script here http://pastie.org/  then share to us the pastie URL link so that we can see the actual codes/script and provide you with more suggestion.

    Just to let you know, you can also just combine a normal web page(your thank you page), and add your PHP script within that page also. So, when you form respondent submitted the form, they will see the Thank You Page but they need not see in the background the PHP script that capture the form submitted data and populated your database.

    Check this discussion thread also as it there is a sample Thank you page PHP script provided that you can combine with your script. 

    Hope this help.

    Thanks.