what I'm doing is passing a hash in the URL from page1.php to page2.php which has been working fine so far but instead of setting $valid to TRUE I want to set a cookie.
Currently I have the code working like this:
if ($hash === md5($key.$test_time)) $valid = TRUE;
To set the cookie instead I tried this:
if ($hash === md5($key.$test_time))
//set "Cookie" for 24 hours
$cookie_value = "Cookie";
setcookie("Placed", $cookie_value, time()+86400);
I am getting these errors:
Notice: Undefined variable: cookie_value in /Dev/sites/files/page2.php on line 19
and
Warning: Cannot modify header information - headers already sent by (output started at /Dev/sites/files/page2.php:19) in /Dev/sites/files/page2.php on line 19
How do I fix this so I can set a cookie instead of a value?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire