Code: Select all
<?php
setcookie("test_cookie", "some_value");
?>I followed some examples given in a php book('
ySQL/PHP Database Applications'), and others show in the official php page (http://www.php.net/manual/en/function.setcookie.php), about the setcookie() function, but none worked for me.
I used the function before every command in my php, as is explained in the official documentation page:
... but not even using it like that worked at all.setcookie() defines a cookie to be sent along with the rest of the HTTP headers. Like other headers, cookies must be sent before any output from your script (this is a protocol restriction). This requires that you place calls to this function prior to any output, including <html> and <head> tags as well as any whitespace. If output exists prior to calling this function, setcookie() will fail and return FALSE. If setcookie() successfully runs, it will return TRUE. This does not indicate whether the user accepted the cookie.
HELP PLEASE