Welcome Guest, Not a member yet? Register   Sign In
cookie problem.. not working.
#1

[eluser]mohsin917[/eluser]
Hello guys.
Yesterday I was trying to set some cookies and get values but today the same code is not working...

Code:
$this->load->helper('cookie');
$cookie = array(
  'name'   => 'loggedin',
  'value'  => 'yes',
  'expire' => '86500',
  'domain' => '/',
  'prefix' => 'apollidon_'
);
        set_cookie('loogedin', 'value');
        
        echo get_cookie('loggedin');


This was giving me yes at white page... But now its becoming headache for me..

Any Idea????
#2

[eluser]mohsin917[/eluser]
Helllloooo guys.....

Nobody Sad
#3

[eluser]n0xie[/eluser]
Code:
set_cookie('loogedin', 'value');
        
        echo get_cookie('loggedin');
#4

[eluser]mohsin917[/eluser]
Its not working...
#5

[eluser]mohsin917[/eluser]
This php code is working but not the CI cookie helper

Code:
$value = 'My cookie data';
setcookie("TestCookie", $value, time()+180);
echo $_COOKIE["TestCookie"];
#6

[eluser]mohsin917[/eluser]
I figured out half problem..

Actually the problem is not in setting a cookie.

problem is in get_cookie.

now this code works.

Code:
$this->load->helper('cookie');
        
set_cookie('loogedin', 'this is my value mohsin', 60);

echo $_COOKIE["loogedin"];

display the exact value and expire after 60 seconds..

But why this below line is not working....
Code:
echo get_cookie('loggedin');
#7

[eluser]mohsin917[/eluser]
Oooo sorry its working now... I have loaded the cookie helper twice.
One in config file and 2nd in the controller..

I remove one and its started working....

Is this a bug or something else??

anyway thanx...




Theme © iAndrew 2016 - Forum software by © MyBB