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.
Issues passing information a 2nd time (after user goes back) to another formAsked by kauseway on January 04, 2015 at 11:31 PM
I have a form:
that passes information with php to a second form in an iframe:
The problem is if someone messes up and goes back to the first form and renters new values, the second form does not take those new values. It is like the browser is holding on to them and wont overwrite them. I was told that passing it into an iframe might fix it but it doesnt seem to. Is this something that I will have to live with or is there a workaround?
I took a look at the jotform and created few submissions to check this and I can see that as you said, the issue happens if the jotform is being redirected to for the second time around.
I first thought that the autofill feature is enabled, but as it was disabled I had checked the URL. The URL that is sent to the jotform each time is different so both times the iframe was loaded with different values, but the old values seemed to still have been in affect.
After giving it a break of 1 minute or so and refreshing the page, the correct values were placed in the fields.
To not beat around the bush, you have it all properly set up, the browser however seems to keep the old value instead of showing a new one.
I think that I might have an idea that would help with this.
You are already pre-populating the iframe through a bit of PHP codding. What I would like to ask you is to create a new parameter and its value at the very start of the URL parameters list.
What I mean by that is that instead of
You make it look like:
To accomplish this just change the PHP code to add rand() function that would create a random number each time as both value and parameter name.
This should cause the browser to get a fresh set of values every time.
Now if you need any help setting it up, do let us know of your current php code there and we would be happy to add the random function to it as well.
In either case, do let us know how it goes.
thanks! here is the original php. Can you let me know what I need to modify? Sorry I could only take a pic. It wouldnt let me copy it.
OK, that is not a problem
Now where you can see this:
$params = '?email=' . $email . '&' . 'beds=' . $beds . '&' . 'baths=' . $baths . '&' . 'freq=' . $freq . '&' . 'postal=' . $postal . '&' . 'sqft=' . $sqft;
we will change it into this:
$params = '?a' . mt_rand(100,500) . '=' . mt_rand(10,5000) . '&email=' . $email . '&beds=' . $beds . '&baths=' . $baths . '&freq=' . $freq . '&postal=' . $postal . '&sqft=' . $sqft;
This should create something like this:
With the numbers in bold changing every time someone comes to your website.
Alternative would be to use plain rand() function instead, but I like this one more as it provides with a truly random number while the plain rand() function is known for producing same random values for a close periods of time.
I have also combined the '&' . 'postal' since it is the same if we write them together or not, while if written together they are (at least to me) easier to follow, so feel free to use them as before, the only important part is the first part right until the email.
Do let us know if you need any assistance or have any questions.
thanks! I tried that but still was taking the old values. Hmm?
I'm not sure how your process flow is structured. Is this correct. You have this form http://www.jotform.us/kauseway/book_now, are you using it as a standalone when providing your users to fill it out? Or is it also embedded in your website? The form http://form.jotformpro.com/form/50005155818954, I believe is embedded to your website? I see you're using a custom Thank You page URL https://naturalcarecleaningservice.com/book-now-checkout/ but it doesn't have PHP file directed to it that will catch your form's value?
This is a sample form custom Thank You Page where I set it up to Form 1.
You can check this guide on how to send POST date to a PHP file using a "Custom Thank You Page URL": Send POST DATA Using PHP Custom Thank You Page
In your example_php.php file you will embed your Form 2 there with proper calling or fetching of POST data coming from Form 1.
Regarding the retaining of values from previous submission, I believe this is because of $_REQUEST call function where values is being set via Cookie, I'm not sure though, you can check the documentation here: http://php.net/manual/en/reserved.variables.request.php. You should try using $_POST instead.
Let us know if this makes sense.