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

  • rrm364
    Asked on November 27, 2014 at 3: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.

  • Ben
    Replied on November 27, 2014 at 9: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

  • rrm364
    Replied 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 );   ?>.

  • Kiran Support Team Lead
    Replied on November 27, 2014 at 2: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.

     

     

     

  • rrm364
    Replied on November 27, 2014 at 8: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

     

  • rrm364
    Replied 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.

  • Ben
    Replied on November 28, 2014 at 9: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