1

I am trying to build a multi step flow that appends URL parameters when a button is clicked. That part I understand. I am struggling with, when a user is sent to a new page, I want it to keep the URL parameter from the referring page and add another parameter/value once a button is clicked on the new page.

The flow would be something like this:

  1. User visits url.com/page1
  2. User clicks button that takes them to url.com/page2/?value=1
  3. User clicks button that takes them to url.com/page3/?value=1&data=1
  4. User clicks button that takes them to url.com/page4/?value=1&data=1&num=1

As you can see in step 3 and 4 the appended parameters are remembered and continue to add on to each other, even as the user visits new pages.

Any ideas on how to solve this? Ideally with just javascript and not php, but open to suggestions.

Would a hidden form field or something like that work?

Thank you for any help!

Wes Asbell
  • 273
  • 1
  • 4
  • 8
  • Keep in mind that there's a 2000 character limit on URL length in some browsers. Further, "QueryStrings on the server should be set to a maximum character limit of 1024" so problems with length will become apparent a lot sooner in some cases. Source: https://mywebshosting.com/what-is-the-maximum-url-length-limit-in-browsers/ – Bytech Aug 04 '22 at 16:29
  • So, just get the url parameters from the current page and use those plus whatever new one you want to add in your referral to the next page. Be aware: url parameters can be changed by the user. – devlin carnate Aug 04 '22 at 16:34
  • Does this answer your question? [Get the values from the "GET" parameters (JavaScript)](https://stackoverflow.com/questions/979975/get-the-values-from-the-get-parameters-javascript) – devlin carnate Aug 04 '22 at 16:37

0 Answers0