Jump to content

php get url and pass it to a variable possible?


phpmistery

Recommended Posts

Hello

I'm using a form to collect user data (is a Cognito form) it is displayed on vacation rental properties pages, so it collects user´s email, in date, out date, etc.
However since my site https://www.bariloche.esp.br/hoteis/hosteria-no-centro-vista-ao-lago uses the same form for several properties, when someone submits, I get the information but I dont know if it comes from here https://www.bariloche.esp.br/hoteis/hosteria-no-centro-vista-ao-lago or https://www.bariloche.esp.br/hoteis/hotel-com-praia-de-lago-ha1 or any other property page.

in the cognito form I have one text hidden field called REF, 

I wonder how to do in order to use the same form and be able to identify where the info comes from. 

I thougt that if I could put the page url into the REF variable, the problem would be solved, but I'm not sure if that is possible and how to do it.

It is?

If not: is it possible to handle that ?

Link to comment
Share on other sites

If you are making the decision when you send the page out as to what property is involved, why not have a hidden field in that same form that identifies the property for you?  Perhaps an id number from your database of properties?  And when you receive the form be sure to validate the hidden id against your database to avoid hackers.

Link to comment
Share on other sites

  • 2 weeks later...

Add a new field to the output form and use type='hidden'.  Then when you received the POST'ed data, be sure to grab that field along with whatever other input fields you are grabbing.   Ok? 

(Perhaps a quick check of your favorite HTML reference would be helpful here.)

Link to comment
Share on other sites

On 4/3/2019 at 5:34 PM, phpmistery said:

in the cognito form I have one text hidden field called REF

What's in this field? It could just be my own personal naming style but this kinda seems like it would hold the referrer value, which sounds like what you want. So, you may have all the information you need already. Otherwise, do as ginerjm suggests and create an additional hidden field with the value you need.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.