Check where user is coming from before send notification

I’m trying to do the following:
I have some buttons in page A - when a user click on button1, he arrives on contact page B and when the form is submitted a notification is sent to Subject1, but if he clicks on button2 the notification should be sent to Subject2 … and so on…

The procedure is the following
→ On page A the button1 contain a link to page B (where the form is) PLUS the variable recipient=subject1
→ on page B an hidden field is populated with the variable recipient
→ after submit, a notification is sent to subject1 if recipient=subject1

Now the problem
If someone arrives to page B directly with the URL pageb/?recipient=subject1 the notification is sent always to Subject1
I’d like instead that this only works when a user comes from pageA and have clicked on button1, and not directly to pageB.

I could use HTTP_REFERER but this is not a valid method (some browser could cut it from http headers)… do you have any suggestions?

What if you chose to use POST instead of GET for your buttons on Page A. I would think this would be far less likely to have your desired results be “manipulated”

You can use some code to prepopulate the hidden field instead of the GUI method in GF.

I am far from a GF developer but this sounds like a good opportunity to use this hook

Good Luck!


Thanks for your help