I a have function that saves an information using a cookie. The problem is, when the webpage loads for the first time i got the error undefined variable "pagination_pos"...How will i set a temporary value of this cookie as blank first so that i can prevent this error..Here is the function:
function getPaginationPos(){
if (isset($_REQUEST['page']) && !empty($_REQUEST['page'])){
setcookie('pagination_pos',$_REQUEST['page'],time() + 86400);
return $_REQUEST['page'];
} else {
return ($_COOKIE['pagination_pos']!='' ? $_COOKIE['pagination_pos'] : 1);
}
}
I get the undefined variable at line 6