Checking for Cookie Support from PHP : _COOKIE « Cookie Session « PHP






Checking for Cookie Support from PHP

 
<?php

    if(!isset($_GET['testcookie'])) {

        setcookie("testcookie", "test value");
        header("Location:  {$_SERVER["PHP_SELF"]}?testcookie=1");
        exit;

    } else {

        if(isset($_COOKIE['testcookie'])) {

            setcookie("testcookie");
            echo "You have cookies enabled";

        } else {

            echo "You do not support cookies!";

        }
    }

?>
  
  








Related examples in the same category

1.Setting and Printing a Cookie Value
2.Get Cookie Data
3.Reading a cookie value
4.Printing a cookie value
5.Still Logged In with cookie
6.Reading all cookie values