proper way to assign JotForm array values in php

  • Profile Image
    milbra
    Asked 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.

  • Profile Image
    EltonCris
    Answered 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
    milbra
    Answered on September 03, 2013 at 07:07 PM

    Thanks, that did it!