Issues passing information a 2nd time (after user goes back) to another form

  • kauseway
    Asked on January 4, 2015 at 11:31 PM

    I have a form:

    http://www.jotform.us/kauseway/book_now

    that passes information with php to a second form in an iframe:

    http://form.jotformpro.com/form/50005155818954

     

    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? 

    Thanks

  • Ben
    Replied on January 5, 2015 at 8:53 AM

    Hi,

    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

    https://secure.jotformpro.com/form/50005155818954?email=support@jotform.com&beds=3&baths=3&freq=0&postal=77002&sqft=2

    You make it look like:

    https://secure.jotformpro.com/form/50005155818954?a123=123&email=support@jotform.com&beds=3&baths=3&freq=0&postal=77002&sqft=2

    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.

    Best Regards,
    Ben

  • kauseway
    Replied on January 5, 2015 at 11:54 AM

    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.

     

    Issues passing information a 2nd time (after user goes back) to another form Image 1 Screenshot 20

  • Ben
    Replied on January 5, 2015 at 1:16 PM

    Hi,

    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:

    $params ='?a328=3294&email=support@jotform.com&beds=2&baths=2&freq=2&postal=77002&sqft=2';

    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.

    Best Regards,
    Ben

  • kauseway
    Replied on January 8, 2015 at 11:52 AM

    thanks! I tried that but still was taking the old values.  Hmm?

     

  • Charlie
    Replied on January 8, 2015 at 2:53 PM

    Hi,

    I'm not sure how your process flow is structured. Is this correct. You have this form 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.

    https://naturalcarecleaningservice.com/book-now-checkout/example_php.php?email={email}&beds={beds1}&baths={baths}&freq={frequency}&postal={postal}&sqft={sqft} 

    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.

    Thank you.