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

    Automatically prepopulating form based on another form

    Asked by lastfrontierheli 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 Using PHP and the Thank You Settings

    format first name populating prepopulating
  • Profile Image
    JotForm Support

    Answered by Mike_T 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.