help writing http referrer to cookie

Discussion in 'PHP' started by adamjthompson, Feb 27, 2006.

  1. #1
    Hey...I'm trying to create a cookie on the user's machine that includes the referral url. I then plan to call the data from the cookie in a script that is called on my thank you page to track sales.

    Why won't the following script work? It's writing "$_SERVER["HTTP_REFERER"]" to the cookie instead of the referrer URL.

    <?php
    $value = '.$_SERVER["HTTP_REFERER"].';
    setcookie("solvotrack", $value, time()+2592000);  /* expire in 30 days */
    ?> 
    Code (markup):
    Thanks!
     
    adamjthompson, Feb 27, 2006 IP
  2. GeorgeB.

    GeorgeB. Notable Member

    Messages:
    5,695
    Likes Received:
    288
    Best Answers:
    0
    Trophy Points:
    280
    #2
    Take out the dots and quotes.

    $value = $_SERVER['HTTP_REFERER'];
     
    GeorgeB., Feb 27, 2006 IP