Welcome Guest, Not a member yet? Register   Sign In
[SOLVED]Cookie problem - Undefined index
#1

[eluser]quince[/eluser]
Hi people,
i'm sick of cookies Smile
i'm trying to load some cookie value into a variable
in controller
$somevalue = $_COOKIE['somecookie'];
but always get error-Undefined index somecookie
this also hapens when i try to do in a model file
but if i use cookie helper then there is no error but i get false
, like cookie isn't there, but it is
where could be a problem
thanks
#2

[eluser]manilodisan[/eluser]
Have you checked your browser to see if the cookies is present? Make sure your cookie is no expiring before you check if it exists. Also make sure it doesn't have a 0 (integer) value set.
#3

[eluser]quince[/eluser]
Hi,
yes, i did, and it's present and it has value 1, it expiring at the end of session,
wierd thing is that i can get the value of the cookie in another controller but only within index function
thanks anyway Smile
#4

[eluser]manilodisan[/eluser]
Are you using $this->input or $_COOKIE?
#5

[eluser]quince[/eluser]
i tried
$_COOKIE
and also
get_cookie()
first case returns error undefined index
second returns nothing, that should be false cause it's cookie helper

$this->input for this i must say i don't have a clue what it is
#6

[eluser]quince[/eluser]
I tried with $this->input but result is the same as when i use get_cookie, empty, nothing
i tried to catch several cookies which i didn't set, nothing
it seems that i can't get value from cookies and sessions,
i did try to change web server, tried using php4 and php5, windows and linux,
it just wont work
help please
#7

[eluser]quince[/eluser]
Did i mentioned that i'm using frames?
and
is there any config things that i have to set?
without cookies and sessions killing myself is only thing i can do Smile
#8

[eluser]quince[/eluser]
i somehow solved this
it seems when i set cookies using setcookie() i can't get it usin' cookie helper - get_cookie() but also can't get it via $_COOKIE var
but
if set cookie usin' cookie helper- set_cookie($cookie) -than get_cookie() works fine




Theme © iAndrew 2016 - Forum software by © MyBB