delxy Posted March 8, 2010 Share Posted March 8, 2010 Hi, i'm not sure this is the right spot for my question ,but i will try. ( sorry if not ) I need to create a script, that sets cookie ,named "something" with a random $value - something(1-500) every time the user refreshes his browser. Something like this : Y.Node.get("#Button1").on("click", function(){ var newValue = "something" + Math.round(Math.random() * Math.PI * 500); Y.Cookie.set("$something", newValue); Y.log("Set cookie '$something' to '" + $something + "'"); But when i refresh the browser the cookie must be with a new Value. I will explain more clearly : I hit Button 1, Activate this script,that sets me the cookie named "something" with a $value for example , something55 I refresh my browser,the same cookie has $value for example something98 Thanks in advance, Regards, Anton P.S. i'm trying to make it work for a few days .so i will be very glad if someone could help me here . Link to comment https://forums.phpfreaks.com/topic/194560-need-help-creating-a-cookie/ Share on other sites More sharing options...
kavisiegel Posted March 8, 2010 Share Posted March 8, 2010 setcookie('something', ($x = rand(1,500)); echo 'Set cookie something to '.$x; Something like that? Link to comment https://forums.phpfreaks.com/topic/194560-need-help-creating-a-cookie/#findComment-1023266 Share on other sites More sharing options...
delxy Posted March 8, 2010 Author Share Posted March 8, 2010 Thanks for reply When i hit refresh on my browser this cookie will have the same $value,isn't it ? Link to comment https://forums.phpfreaks.com/topic/194560-need-help-creating-a-cookie/#findComment-1023267 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.