ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Change template form fields with different referrers

July 04, 2007 10:22am

Subscribe [4]
  • #1 / Jul 04, 2007 10:22am

    sallyoz

    5 posts

    Hi

    I have a booking form in which I would like to add extra hidden fields when visitors link to my site from a link on agent referrer sites.  The form is in the secure section and is linked to the home page.  HTTPS is called on the booking form template as follows:

    <?php global $PREFS; $PREFS->core_ini[‘site_url’] = ‘https://ozexperience.com/’; ?>

    Simple question but how do I store the current referrer IP address in a global variable and pass it through to the booking form.  At the moment the IP address changes to my IP when I click on the form but I want the original referrer IP address.

  • #2 / Jul 04, 2007 10:27am

    Ingmar

    29245 posts

    Something like ...

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

    ... I imagine. Untested.

  • #3 / Jul 04, 2007 6:34pm

    sallyoz

    5 posts

    Not that easy I’m afraid.  That just gives my site as the referrer -
    <input type=“hidden” name=“referer” value=“http://www.ozexperience.com/” />


    I am in effect doing a redirect with the
    <?php global $PREFS; $PREFS->core_ini[‘site_url’] = ‘https://ozexperience.com/’; ?>
    at the beginning of the form.  I want to store the value of the referrer from the home page not the booking page as it changes in my redirect.

  • #4 / Jul 05, 2007 3:11am

    Ingmar

    29245 posts

    Well, it does record the referrer, but since you’re doing a redirect already, that will be the one the form sees. You’ll need to rethink how you handle these forms, or perhaps store the referrer at the time you are redirecting yourself. There is no way to determine the referrer before the actual one, so to speak, that I am aware of.

  • #5 / Jul 05, 2007 5:17am

    silenz

    1651 posts

    Pass it in the query string when redirectiing and handle it afterwards?

    <?php global $PREFS; $PREFS->core_ini['site_url'] = 'https://ozexperience.com/?ref='.$_SERVER['HTTP_REFERER']; ?>

    Or store it in a cookie?

  • #6 / Jul 05, 2007 7:49am

    sallyoz

    5 posts

    Well that was the original question!  “How do I store the original referrer and pass it to the booking form”  It needs to be hidden hence not in the url string.. I will try the cookie idea though.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases