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 parse JSON with PHP to be able to put individual form answers into individual PHP variables?

    Asked by jk8conmed on December 06, 2013 at 09:18 PM

    I have the PHP Api installed, and I am able to display the JSON as an Array. I just don't understand how to use foreach to spit out the answers individually. Thanks. I know this is basic but this all I really need it to do. 

     

    I have:

     

     $form= $jotformAPI->getFormSubmissions("xxxxxxxxxxxxxxxxx");

     

    variables thanks how to use
  • Profile Image
    JotForm Support

    Answered by EltonCris on December 06, 2013 at 10:42 PM

    Hi there,

    Example if you have the following response,

    You can write;

    $form= $jotformAPI->getFormSubmissions("xxxxxxxxxxxxxxxxx");

    $form['id'] //this will get the Submissions ID

    $form['form_id'] //this will get the form ID

    $form['answers'][3] //get the submissions 3 array.

    It would be pretty easy if you could dump the data into a php array so you can easily identify the array keys. Just use var_dump($form) to dump the data.

    You can also find out more examples here: http://developers.jotform.com/libraries#jotform-api-php

    Thanks!

  • Profile Image

    Answered by jk8conmed on December 06, 2013 at 11:25 PM

    Sorry, I know this is rudimentary. 

    but 

      echo $form['id'];

      echo $form['form_id'];

     

    doesn't return anything.

  • Profile Image

    Answered by jk8conmed on December 06, 2013 at 11:57 PM

    nevermind! I figured it out!