• 0

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

PHP cookies are always empty when trying to access them

So i am setting cookies here. They are totally working since when i go onto my firefox privacy thing, i can see the cookie there and its value, but the moment i am trying to read it or to echo it, it is always giving me a blank result...

I am using Wordpress, and i call the setcookie with an ajax request from a click of a button. Here how i do it under here :

This script is inside templateDirectory/js

$('.bucket-list').on("click", function () {      $.ajax({         url: templateDir + '/js/list.php'     }); 

Inside the php file list.php, we have this :

setcookie("displaymode", "list" , time() + 3600 * 24 * 30);  

Up to here as i said i can see the cookie inside my browser, but when i try to call it, it just keep on giving me blank result, like this :

if ($_COOKIE["displaymode"] == "list")          echo '
' ; else { echo '
' ; echo ''; } ?>

this script up there is located in the main file (homepage.php) from the templateDirectory. Any help would and will be greatly appreciated.

Download script demo [LINK] [Origin]
Download script demo [LINK 2] [Onedrive] Download script demo [LINK 2] [Google drive]