TeddyKiller Posted May 30, 2010 Share Posted May 30, 2010 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? Link to comment https://forums.phpfreaks.com/topic/203377-setting-a-cookie-in-javascript-and-echoing-it-in-php-help/ Share on other sites More sharing options...
andrewgauger Posted June 3, 2010 Share Posted June 3, 2010 You know, I have a lot of issues with referencing this while using html tags. Try changing this to the actual reference. So give your input an id and use document.getElementById("id_of_element").value Link to comment https://forums.phpfreaks.com/topic/203377-setting-a-cookie-in-javascript-and-echoing-it-in-php-help/#findComment-1067038 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.