Forum Replies Created

Viewing 2 replies - 16 through 17 (of 17 total)
  • Thread Starter tomkinsg

    (@tomkinsg)

    I managed to get this working. I don’t know what it was that i was doing wrong because it suddenly started to work.

    Here is what i am going. In my one wordpress page, I have a lbutton generated in PHP that links to another wordpress page (new-page) as follows:

    <A HREF=”/wordpress/new-page/” onclick=”var cookie_date = new Date();document.cookie = ‘class=CLASSCODE1; path=/'”>

    It sets cookie called “class” to the value CLASSCODE1.

    Then in New-page, I am using the RunPHP plug in and I have the following code:

    <?php
    print_r($_COOKIE);
    ?>

    Which produces the following output showing teh cookie is set:

    (
    [wordpressuser_bbfa5b726c6b7a9cf3cda9370be3ee91] => admin
    [wordpresspass_bbfa5b726c6b7a9cf3cda9370be3ee91] => efa8253fd02c8bfc71a3aa83dc159a9b
    [dbx-pagemeta] => grabit=0 ,1 ,2 ,3 ,4 ,5 &advancedstuff=0-
    [dbx-postmeta] => grabit=0 ,1 ,2 ,3 ,4 ,5 ,6 &advancedstuff=0-
    [class] => CLASSCODE1
    )

    Did anyone get cookies working in WordPress… i have the same problem and i believethat i am setting the cookies correctly since non-wordpress parts of the site can access the cookie values.

Viewing 2 replies - 16 through 17 (of 17 total)