Test for cookies in PHP -


what best way tell if has cookies enabled in browser. tried:

<?php          setcookie('cookies','yes',time()+7200);     if (!isset($_cookie['cookies'])) {         echo '<div class="error" style="float:right;">you must enable cookies , javascript use site.</div>';     } else {         echo '';     }   ?> 

but displays alert if cookies enabled. want alert if cookies not enabled.

the reason code doesn't work because cookies sent request. code you're trying work, setcookie has in different request isset call. try calling redirect in between calling 2 functions.


Comments

Popular posts from this blog

c# - BasicHttpBinding equivalent CustomBinding using WCF Client and PHP WebService -

android - Cannot use ndk-build on Cygwin -

sql server - python to mssql encoding problem -