Referring HTTP Header

Also with my form I have been asked to capture the url from where the form is submitted from. I am using 1 form on all pages so the request has to be dynamic.

The client’s developer has sent this:

<?php echo "httpd://newyoubootcamp.com".$_SERVER["REQUEST_URI"]; ?>

Now as I know pretty much nothing about php, does anyone know what I do with the above code?

Thanks


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

REQUEST_URI captures the URL of the form page itself, not the page that referred it. If you have multiple form pages and a single form handler, then this would be useful information, but the usual method is to have a form handle its own submissions, in which case it already knows “who” it is, and the interesting question is “what page was the visitor on before they came to the form page?”. To get that bit of data, you want to use HTTP_REFERER (yes, only one R in there, that’s how the header is mis-spelled) to capture that. So the visitor is on the Camp Splashing Waters page, and clicks on the “Send Me More Information” link there, which takes her to more_information.php. In that form page, you would add a hidden field like this:

<input type="hidden" name="request_from" value="<?= $_SERVER['HTTP_REFERER'] ?>" />

When the form is submitted, you would have the request_from value filled in with the address of the Camp Splashing Waters page, and you could disambiguate which camp the customer was interested in, or at least know which of your pages was pulling harder than the rest.

Walter

On Sep 11, 2013, at 2:40 AM, BigG wrote:

Also with my form I have been asked to capture the url from where the form is submitted from. I am using 1 form on all pages so the request has to be dynamic.

The client’s developer has sent this:

<?php echo "httpd://newyoubootcamp.com".$_SERVER["REQUEST_URI"]; ?>

Now as I know pretty much nothing about php, does anyone know what I do with the above code?

Thanks


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Walter,

Aha… that will be perfect for my main Enquiry Page where visitors click through from most pages to a make an enquiry. Thanks…

I also have forms on the bootcamp pages that are Quick Enquiries so the visitor does not leave those pages to submit a form. Therefore I need to capture that info in this case.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options