Help with cookies

Discussion in 'HTML & Website Design' started by moscorp, Nov 20, 2008.

  1. #1
    I am having a terrible time trying to Get a cookie and include it in my form results any suggestions?

    I just brought on my first affiliate and were are going to track his sales through cookies, his landing page has a cookie added.. not when people go to my form page I want to grab the cookie information and insert it as a hidden field in my form.

    You help would be appreciated
     
    moscorp, Nov 20, 2008 IP
  2. moscorp

    moscorp Guest

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2

    More precisely I have this

    <script type="text/javascript">

    var x = readCookie('ppkcookie1')
    if (x) {
    [do something with x]
    }

    function readCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {
    var c = ca;
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
    }

    </script>

    And I am trying to get the results to go in here

    <input name="refer" value= (what goes here) type="hidden">
     
    moscorp, Nov 20, 2008 IP