<?php

$test = cookieTest();                          //test acceptance of a cookie

print "<h2>Check to see if client browser accepts cookies</h2>";

echo ($test == true) 
     ? "Client browser accepts cookies"
     : "Client browser does not accept cookies";


//*****************************************************************************************
//Test to see if the client accepts cookies 
//*****************************************************************************************
function cookieTest()
{
    $pageName = $_SERVER['PHP_SELF'];               //this page  

    header("set-cookie: testCookie=value");         //set a cookie

    if (! isset($_GET['testDone']))                 //test is not performed yet?
        header("location: $pageName?testDone");     //reload/redirect to test setting of cookie
    else                                            //test is done?
        if (isset($_COOKIE['testCookie']))          //does the testCookie exist?
            return(true);
        else
            return(false);
}
//*****************************************************************************************

?>

<?php include "../include.php"; ?>              <!-- hyperlink to see the code -->

<html>
<br>
<h3>The rest of the page...</h3>
<p>Blah, blah, blah...</p>
</html>