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

    Great tutorial but something's not quite working right.

    Asked by FFS_user on November 06, 2016 at 04:59 AM

    Great tutorial but something's not quite working right.

    We've embedded two jotforms on our wordpress site. Form 1 needs to pass the email and name fields to form 2. The email field is posting fine but the name field is not.

    In my redirect.php file, if I use the name fields like they are in the tutorial -

    $var1 = "?fullName[first]=".urlencode($answers[fullname][0]);

    $var2 = "&fullName[last]=".urlencode($answers[fullname][1]);

    - then the name doesn't pass to form 2. It's just blank.

    But if I change it to this -

    $var1 = "?name[first]=".urlencode($answers[name][0]);

    $var2 = "&name[last]=".urlencode($answers[name][1]);

    then the name passes fine to the form but gives this error:

    Warning: trim() expects parameter 1 to be string, array given in /XXX/XXX/wp-includes/query.php on line 1609

    Not sure what I'm doing wrong. Perhaps it's a conflict with wordpress files. Any ideas?

    Form 1 is here:

    http://tinyurl.com/gtbqzj4

    (which references this form https://form.jotform.com/62437535188160)

    It redirects to form 2 here:

    http://tinyurl.com/hh8fhop

    (which refrences this form https://form.jotform.com/63063550543148)

    Thanks for any help.



    This is a re-post of a comment on Send Submission Data via POST Method Using PHP and the Thank You Settings

    JotForm name site thanks
  • Profile Image
    JotForm Support

    Answered by liyam on November 06, 2016 at 12:19 PM

    Hello,

    The fullName[] is actually a name of the field that should capture a value. So on the example on the guide, fullName[first] is the exact name set in the input field on the source code

         Example: <input type="text" name="fullName[first]" class="someClass">

    So to why it's not working in your form is because your 2nd form have the following values

       q7_name[first]
       q7_name[last]

    With the rule on forms on JotForm, the characters up to the underscore are to be omitted. Therefore we only have

       name[first]
       name[last]

    So the 2nd one is correct. What's wrong how trim() function is being used. As the error stated: Warning: trim() expects parameter 1 to be string, array given in /XXX/XXX/wp-includes/query.php on line 1609

    This means that a value is being passed, but the value is not a string. Unlike the 1st use which returns blank or empty and probably it gets disregarded.

    Now to understand further what's in line 1609 - can you provide more information on this part of your code? What is it trimming?

    Will look forward to your response.

    Thanks.