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

    Is there a way of seeing the raw $_POST data of the form?

    Asked by jalleyne on June 24, 2015 at 03:28 PM

    For debugging purposes, I'm making a hardcoded set of data from a form, http://www.jotform.com//?formID=51624353720146 so that I don't have to continuously fill the form to test methods when parsing the data. However, somehow, I can't get my 2D array to have the same format output as yours. Is there a way I can see the php you use to send the data to an external url?

     

    For reference, here's the output jotForm sends to the url:

    Array ( [0] => ["","024 JRG","7.7","1.74","14","delta\/gamma","Sorted cells"][1] => ["","013 Joe","5.6","2.3","13","delta\/gamma","Sorted cells"] [2] => ["","003 LQ","16.9","1.6","13","delta\/gamma","Sorted cells"] [3] => ["","001 MD","13.3","1.5","13","delta\/gamma","Sorted cells"] );

     

    Here's the output from sample data I have constructed:

    Array ( [0] => Array ( [0] => [1] => 024 [2] => JRG,7.7 [3] => 1.74 [4] => 14 [5] => delta/gamma [6] => Sorted cells ) [1] => Array ( [0] => [1] => 013 Joe [2] => 5.6 [3] => 2.3 [4] => 13 [5] => delta/gamma [6] => Sorted cells ) [2] => Array ( [0] => [1] => 003 LQ [2] => 16.9 [3] => 1.6 [4] => 13 [5] => delta/gamma [6] => Sorted cells );

    I'm looking for a way of condensing the inner arrays that output from my code to match the output from jotForm.  

     

    Page URL:
    http://www.irepertoire.com/#!sample-submission-form/ctc0

    seeing a JotForm style size font
  • Profile Image

    Answered by Sammy on June 24, 2015 at 04:40 PM

    You can redirect the form to a custom URL  hosting a php page, you will then be able to check the post data being sent from the form using the following php routing var_dump($_POST).

    Here's what you need to do to enable sending of post data

    1. Under preferences->Advanced Form settings, enable the send POST data option

    2. Next change the thank you url to a custom url page where you want the form to redirect to after posting, this is where you will fetch the POST data.

     

  • Profile Image

    Answered by jalleyne on June 24, 2015 at 05:17 PM

    I was able to get the post data to another url and view the data. My question was about the data output. When sending form data to a url, somehow 2D arrays are outputted in a format that mixes short and long syntax: 

    Array([0] => [v1, v2, v3], [1] => [v1,v2,v3]);

     

    But I can't seem to get my data (which should be mirroring the data the form sends) to be formatted that way. So it comes out as:

    Array([0] => array([0] => v1, [1] => v2, [2] => v3), [1] => array([0] => v1, [1]=>v2, [2] =>v3))

    I want to make the format that my data outputs the same as the data the jotform outputs, so simply viewing more info on the variables is not particularly helpful. I currently have the array hardcoded like this: 

    Array( 0 => ["" ,"024","JRG,7.7","1.74","14","delta/gamma","Sorted cells"],

       1 =>["","013 Joe","5.6","2.3","13","delta/gamma","Sorted cells"] .... );

    is this what the source code for the data should look like before being processed by php? 

     

  • Profile Image
    JotForm Support

    Answered by jonathan on June 24, 2015 at 06:17 PM

    in your statement...

    I want to make the format that my data outputs the same as the data the jotform outputs,

    I assume you were referring to your own PHP code that does the formatting script.

    Did you check already using the custom TY URL http://www.jotform.com/show-post-data

    It is not really clear what you wanted to do, but if you can share to us the PHP script you were using to 'format' the data output (which I assume is this jotform.irepertoire.com/test.php) we will be able to understand what you wanted to do, and we will be able to provide a better suggestion.

     

    Thanks.

     

     

     

     

     

  • Profile Image

    Answered by jalleyne on June 24, 2015 at 11:42 PM

    Sorry, I'm new to php, so I'm not very good at articulating what help I need. In my php file, I have hardcoded an array to match the $_POST data. In it I have a two dimensional array 'sampleinformation29' =>Array( 0 => ["" ,"024","JRG,7.7","1.74","14","delta/gamma","Sorted cells"],

    1 =>["","013 JC","5.6","2.3","13","delta/gamma","Sorted cells"],

    2 => ["","003 LQ","16.9","1.6","13","delta/gamma","Sorted cells"], 

    3 => ["","001 MD","13.3","1.5","13","delta/gamma","Sorted cells"]), 

    which is part of the $_POST array. When I type in print_r($dataForm), $dataForm being an array that mirrors the $_POST array that contains sample values in the syntax you see above, the output is 

    [sampleinformation29] => Array([0] => Array([0] => "" [1] => 024[2] => JRG)
    rather than
    [sampleinformation29] => Array([0]=>["","024","JRG"]

    I was wondering if you could tell me how you got the data do look like that ( Array([0]=>["","024","JRG"]) with the values of the inner arrays condensed into ["value", "value"]
     
  • Profile Image

    Answered by jalleyne on June 24, 2015 at 11:49 PM

    Alternatively, could you tell me how to access "val 2" in the following code? This is the output format that jotForm gives for a "matrix" style question. 

     [sampleinformation29] =>

    Array ( [0] => ["val1","val2","val3"] , [1] => ["val a","val b","val c"] )

     

    I have tried

    echo $_POST['sampleinformation29'] [0][1];

    but the output ends up just being " rather than val1. The previous questions where so that I could debug locally rather than having to continuously fill out a form to test, but if you could tell me how to get to "val2" it would ultimately solve my problem as well. 

     

    I apologize for the confusion. 

  • Profile Image
    JotForm Support

    Answered by Charlie on June 25, 2015 at 03:20 AM

    Hi,

    I'm currently looking at this, but could you try using Webhook instead? Here's a guide on that: http://www.jotform.com/help/245-How-to-Setup-Webhook-with-JotForm.

    It looks like it's not a multidimensional array but rather a long string, but I'm not sure of it, I'm still doing some test, for the meantime, please do explore "Webhook" instead. It should give you a more easy way to get your raw data on an HTTP POST.

    I'll get back to you when I found a way on the original issue.

    Thank you.

  • Profile Image
    JotForm Support

    Answered by Charlie on June 25, 2015 at 04:43 AM

    Hi,

    I was able to resolve the problem, the reason is that it is not an array. Example: echo $_POST['sampleinformation29'][0][1] only outputs " or something like \, this is because it is the position in the string.

    This is what you can do, convert the $_POST['sampleinformation29'][0] into an array using this:

    $row1 = preg_split("/[\s,]+/", $_POST['sampleinformation29']['0']);

    It will then create an array for the first row of that array, you can now access the information on that array.

     

    To print the array you can use this: 

    print_r($row1);

     

    To call any of the value on that row, you can refer using indexes on a normal array. I use stripslashes to remove the "\" in it. 

    echo stripslashes($row1[1]);

     

    You can repeat the process on each row, or you can just create a while or for loop.

    Do let us know if you need more information on this.