-
FFS_userAsked on November 6, 2016 at 4: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.
-
liyamReplied on November 6, 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.