Jump to content

setting a cookie in javascript, and echoing it in PHP Help...


TeddyKiller

Recommended Posts

I have this javascript function...

function setCookie(VALUE) {
    var NAME = 'myCookie';
    var DATE = new Date();
    
    DATE.setTime(DATE.getTime()+(15*60)); // Minutes * Seconds 
    
    var EXPIRE = DATE.toGMTString();

    document.cookie = NAME + "=" + VALUE+"; expires=" + EXPIRE + " path=/";
}

 

then I have this..

<input type="text" name="pollName" onkeyup="setCookie(this.value)" value="<?php echo $_COOKIES['myCookie'] ?>"/>

 

It doesn't echo the cookies value.. whats wrong?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.