Automatically prepopulating form based on another form

  • Profile Image
    lastfrontierheli
    Asked on May 02, 2013 at 01:29 PM

    Hi,

     

    Could you please explain "$var1 = "?fullName3[first]=".urlencode($answers[fullname3][0]);"

     

    Is "fullName3[first]" the id of the initial form and "[fullname3][0]" the ID of the the field in the second form that should be pre-populated?

     

    My first form has the First name and Last name as simple text fields, and the second form (that I want populated with the names from the first form) has them in the "Full Name" format, could this be causing an issue? (I have the email pre-populating fine, but the names are not. If I understood what is being referenced by the redirect.php code (is it the field ID, name etc) I would be able to figure out my issue.

     

    Any help would be greatly appreciated!

     

    Additional Note

    I forgot to include the forms:

    I want the fields from this form:
    http://form.jotformpro.com/form/31194822551957

    To populate this form:
    http://form.jotformpro.com/form/30999279639982

    Thanks



    This is a re-post of a comment on Send Submission Data via Post Method and Thank You Settings

  • Profile Image
    Mike_T
    Answered on May 02, 2013 at 02:32 PM

    Thank you for contacting us.

    You can try the following code:

    <?php
    $answers = $_POST;
    $url1 = "http://form.jotformpro.com/form/30999279639982";

    $var1 = "?fullName1[first]=".urlencode($answers[firstname]);
    $var2 = "&fullName1[last]=".urlencode($answers[lastname]);
    $var3 = "&email3=".urlencode($answers[email]);
    $url2 = $url1.$var1.$var2.$var3;
    header("location:$url2");
    ?>

    fullName1[first] - is referring to the First Name input on your second form.

    $answers[firstname] - is referring to the post data from your first form.

    You can also run the following script instead of the redirect code in order to see the full post data array:

    <?php
    print_r($_POST);
    ?> 

    If something is not clear, please let us know. We will be happy to help.