php - problem with cookies -


i have page create cookie value using set_cookie this:

setcookie("is_voted","1",time()+60*60*24*10,"/~poll/","spacepower.tv"); 

but can't cookie value using $_cookie array

how fix problem ?

i've encountered same problem. according php manual:

cookies not become visible until next loading of page cookie should visible for. test if cookie set, check cookie on next loading page before cookie expires. expire time set via expire parameter. nice way debug existence of cookies calling print_r($_cookie);.

basically, $_cookie superglobal updated when script first runs. if set new cookie, won't available in $_cookies. have start script see updated $_cookie values. if don't see them then, have problem.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -