Unable to print cookie in php

Hi There,

I am trying to set cookie for my website to block some countries.

I am setting cookie something like this.

setcookie (“mynewblockingcookie”,“1”,time()+31536000,‘/’);

And this is how I am trying to print the cookie.

$mycookie = $_COOKIE[“mynewblockingcookie”];

PROBLEM.

the problem is…when I printing cookie in admin folder/panle…its working and showing value 1.

But when I tried to print it on my root folder (User End), it shows nothing.

Please let me know where I mistook? I checked the cookie in browser setting…its showing, its printing in admin section, but it shows nothing on user end.

Thanks in advance for your appreciable help.

Thanks!!

Well your printing line isnt a printing line, it’s an assigning line.
Just to cover all the bases…
#1: The admin folder/panel is on the same domain as the user end. (Everything before the third / in the URL is the same).
#2: You havent misspelt the cookie name on the user end.
#3: You’re using an actual echo or print to display the cookie value
#4: You’re doing so in a place that is -visible- on your user end.

Thanks Star…

I got it working…actually I have to open my website in new tab once cookie is set.

As in current tab cookie was not recognized…

Its working…Thanks for your help!