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

    proper way to assign JotForm array values in php

    Asked by milbra on September 02, 2013 at 11:33 PM

    I have a test form which uses the Quick Tools address. When I send the form to PHP code ( print_r( $_POST ); ), it results in this array pertaining to the address...

    ... [address3] => Array ( [0] => 123 main st. [1] => po box 456 [2] => dawson [3] => ma [4] => 98765 [5] => United States ) ...


    I tried the following code. The non-array info assignments worked, but not the array. Could you please help me with the proper array format?

    <?php

        $sub_id = $_POST['submission_id'];
        $form_id = $_POST['formID'];
        $ip = $_POST['ip'];
           
        $address1 = $_POST['address3[0]'];
        $address2 = $_POST['address3[1]'];
        $address_city = $_POST['address3[2]'];
        $address_state = $_POST['address3[3]'];
        $address_zip = $_POST['address3[4]'];
        $address_country = $_POST['address3[5]'];

    ?>

    Thank you.

    Page URL:
    http://form.jotform.co/form/32448759420863

    JotForm format test form tools 123
  • Profile Image
    JotForm Support

    Answered by EltonCris on September 03, 2013 at 01:00 AM

    Hello,

    Do not put the index value inside the field names, it should be like this:

        $address1 = $_POST['address3'][0];

        $address2 = $_POST['address3'][1];

    This should work. Thanks!

  • Profile Image

    Answered by milbra on September 03, 2013 at 07:07 PM

    Thanks, that did it!