Forum Moderators: coopster

Message Too Old, No Replies

PHP Question. How to grab current URL and send in an email

         

misfit949

4:23 pm on Oct 25, 2006 (gmt 0)

10+ Year Member



I'm sure this will be a piece of cake for you guys. I currently have a form that my company uses for several different promotions that users arrive at through a variety of sources. Each one of these sources have their own referrer i.e Adwords, email ad, etc.

What I would like to do is have a function that will capture the web address currently displayed on the nav bar i.e [mysite.com...]

and simply place that address in the email.

How would I do this?

sned

4:46 pm on Oct 25, 2006 (gmt 0)

10+ Year Member



You could try this:

$url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];

-sned

justgowithit

5:13 pm on Oct 25, 2006 (gmt 0)

10+ Year Member



Hmm….

It sounds like you're looking to get a handle on your advertising ROI through individual emails of referrers.

If this is the case have you thought of tracking software (or custom app) that will give you far more in-depth info?

misfit949

5:29 pm on Oct 25, 2006 (gmt 0)

10+ Year Member



Thanks Sned, that worked perfectly!

whoisgregg

6:37 pm on Oct 25, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another way to do this is on the form page itself:

<input type="hidden" name="http_referer" value="<?php echo $_SERVER['HTTP_REFERER'];?>" />

Then you get the actual referrer string sent by the user. :)