php - Test if a cookie exist with it name in a variable -
i'd test if cookie exists, pretty basic, know, doesn't want work well. so, here pieces of code related:
<?php $quesid = the_id()."gcquestion"; if(isset($_cookie[$quesid])){ ... } the test fails, when cookie's name match generated variable. weird part when try type variable name hand if(isset($_cookie["94gcquestion"])), works.
question : can use variable name $_cookie ?
assuming you're using wordpress,
the_id(): displays numeric id of current post. tag must within loop.
the_id() template function , print id, doesn't return it.
to return id, use get_the_id() instead.
<?php $quesid = get_the_id()."gcquestion"; if(isset($_cookie[$quesid])){ ... }
Comments
Post a Comment