This is my code for reading my cookie settings and cookies in php in this cookie.
jsglobalset .html:
& lt; Script & gt; Var value = "opium" document.cookie = "textout =" + value + "; path = /"; & Lt; / Script & gt;
phpglobalread.php:
& lt ;? Php $ messsage = $ _COOKIE ["text"] ;; If ($ message! = "") {Echo $ message; } And {echo "failed to read."; }? & Gt;
The output of phpglobalread.html:
failed to read
I tried to read the cookie in javascript And it works, but I can not read in php. any idea? Thank you.
& lt; Php $ messsage = $ _COOKIE ["textout"]; If ($ message! = "") {Echo $ message; } And {echo "failed to read."; }? & Gt;
You are saying $ messsage = $ _COOKIE ["textout"]; , But if you have $ message on var, then $ messsage is not there.
Try:
& lt ;? Php $ message = $ _COOKIE ["textout"]; If ($ message! = "") {Echo $ message; } And {echo "failed to read."; }? & Gt;
No comments:
Post a Comment