Hello windandwaves,
[color=blue][color=green]
>> How do I test if a user has a given cookie? O:-)
>>
>> Thanks
>>[/color]
> Here is how I do it:
>
> //set the cookie:
> setcookie("Cook ieTest", "t");
> //test of the cookie exists (can only be done in the next page / load)
> if($_COOKIE["CookieTest "] == "t") {
> echo "cookie exists";
> }[/color]
Thanks it works. However, if the cookie doesn't exist, I get a warning on
the rendered page similar to this one:
Notice: Undefined index: aTestCootie in c:\proyectos\we bsites\test\act ion.php
on line 13
That's great for debugging, but how do Iavoid this from showing up in production
code?
Fernando Rodríguez wrote:[color=blue]
> Hello windandwaves,
>[color=green][color=darkred]
>>> How do I test if a user has a given cookie? O:-)
>>>
>>> Thanks
>>>[/color]
>> Here is how I do it:
>>
>> //set the cookie:
>> setcookie("Cook ieTest", "t");
>> //test of the cookie exists (can only be done in the next page / load)
>> if($_COOKIE["CookieTest "] == "t") {
>> echo "cookie exists";
>> }[/color]
>
>
>
> Thanks it works. However, if the cookie doesn't exist, I get a warning
> on the rendered page similar to this one:
> Notice: Undefined index: aTestCootie in
> c:\proyectos\we bsites\test\act ion.php on line 13
>
> That's great for debugging, but how do Iavoid this from showing up in
> production code?
>
> Thanks
>
>[/color]
if (isset($_COOKIE['CookieTest'] && $_COOKIE['CookieTest'] == 't') ...
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. jstucklex@attgl obal.net
=============== ===
Comment