Pass hidden value of a form and retrieve it in thank-you page

225 Views Asked by At

Is there a solution to get a value to a thank-you page that is not GET?

For a marketing and analytical issue, I need to retrieve the form_id on the thank-you page of the form from which it comes.

Several forms go to the same thank-you page.

Is it viable for custom.php to launch the thank-you page?

enter image description here

In addition, Drupal's form settings forces to use one of these redirects enter image description here

With GET all will be easier, but I don't want to add params in the URL.

Thanks for clarifying me solutions

1

There are 1 best solutions below

1
SINGH On BEST ANSWER

You can try same with two ways.

a. Using session

b. Using LocalStorage

a) Using session when you submit the form.Just store value in you session

$_SESSION['form_id'] = 'xyz';

In thankyou page you get use it:

echo $_SESSION['form_id];

Note: Make Sure start your session before set value.

b) Second way is html5 local storage.

localStorage.setItem("form_id", "xyz");

And over thankyou page you can get this value

localStorage.getItem("form_id");