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

    How do you insert print_r( $_POST ); ?> into form?

    Asked by rrm364 on November 27, 2014 at 03:57 AM

    I am having trouble getting started in getting data from my form into my database. I have set up so that data is posted to a custom url. I've downloaded the source code and placed it into the root. The best I can think of is just to add <?php print_r( $_POST );   ?> at the bottom of the form.

    I know some javascript, html and css but I'm just starting with PHP. I would really appreciate it if you could show me how to get the proper array from this sample form.

    Page URL:
    http://www.jotform.com//?formID=42523995394163

    JotForm custom url source php submission to db database
  • Profile Image

    Answered by Ben on November 27, 2014 at 09:51 AM

    Hi,

    You do not need to download source code and if you do implement it as you have mentioned, it will not capture the data like that, since it should capture it after submission is made.

    What I would suggest is to check this guide: How to send Submissions to Your MySQL Database Using PHP.

    If you have any questions along the way or need any further help do let us know and we would be happy to help.

    Best Regards,
    Ben

  • Profile Image

    Answered by rrm364 on November 27, 2014 at 12:01 PM

    Following that guide, I was wondering if you could expand on this part of the instructions a little.

     

    The data being posted by JotForm is actually an array so to find out the array keys and values, you will have to try to insert this in your script:

       print_r( $_POST );   ?>.

  • Profile Image
    JotForm Support

    Answered by Kiran on November 27, 2014 at 02:21 PM

    Well, the captured form data is in the form of an array and in order to transfer this captured data to database you'll need to extract the array data to different variables. As you see in the guide, the print_r command prints the data of an array so that you can find the data captured by different fields on the form that includes hidden values such as Submission ID, Form ID, IP address, etc. 

    You can actually try submitting the form http://www.jotform.com/form/11814245193 to see how the array is printed. This form is redirected to custom Thank you page that is having print_r command in question to show the output of data captured.

    Hope this information helps. Let us know if you have any other questions. We will be happy to help.

     

     

     

  • Profile Image

    Answered by rrm364 on November 27, 2014 at 08:13 PM

    Sorry. Let me be a little more specific. Where precisely do I insert    print_r( $_POST );   ?>.

     

    I assumed I was supposed to download the html file for the form, and put the PHP somewhere in there. That's what I've done with simple forms in the past, but that doesn't look to be the case. I'm not sure where else I could put that bit of code. I know what the array should like, but I'm not sure how to get to that.

    I have a really simple form called Title Me. If I wanted to insert print_r($_POST) what would I do to that form. Do I need to go to the source code, or is there somewhere else I am supposed to put print_r( $_POST );   ?>.?

     

    EDIT: Am I looking to do something like this?

    http://www.jotform.com/help/213-Send-POST-Data-From-JotForm-Using-PHP-in-Custom-Thank-You-Page

     

  • Profile Image

    Answered by rrm364 on November 27, 2014 at 11:36 PM

    You don't need to answer my questions. A little application of common sense fixed the problems.

  • Profile Image

    Answered by Ben on November 28, 2014 at 09:13 AM

    Hi,

    I am glad that you were able to resolve your questions.

    Do let us know however if you have any further questions and we would be happy to answer them.

    Best Regards,
    Ben