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

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -