# Referring HTTP Header

**URL:** <https://discourse.softpress.com/t/referring-http-header/18480>\
**Category:** Freeway\
**Created:** [September 11, 2013, 6:40am UTC](https://discourse.softpress.com/t/referring-http-header/18480 "2013-09-11T06:40:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BigG](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/b/47e85d/32.png) [@BigG](https://discourse.softpress.com/u/BigG)\
**Post date:** [September 11, 2013, 6:40am UTC](https://discourse.softpress.com/t/referring-http-header/18480/1 "2013-09-11T06:40:21Z")

</div>

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](http://freewaytalk.net/person/options)

---

<div class="post-metadata">

**Author:** ![waltd](https://discourse.softpress.com/user_avatar/discourse.softpress.com/waltd/32/2720_2.png) [@waltd](https://discourse.softpress.com/u/waltd)\
**Post date:** [September 11, 2013, 1:27pm UTC](https://discourse.softpress.com/t/referring-http-header/18480/2 "2013-09-11T13:27:38Z")

</div>

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](http://freewaytalk.net/person/options)

* * *

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

---

<div class="post-metadata">

**Author:** ![BigG](https://discourse.softpress.com/letter_avatar_proxy/v4/letter/b/47e85d/32.png) [@BigG](https://discourse.softpress.com/u/BigG)\
**Post date:** [September 11, 2013, 4:36pm UTC](https://discourse.softpress.com/t/referring-http-header/18480/3 "2013-09-11T16:36:51Z")

</div>

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](http://freewaytalk.net/person/options)
