how to set a cookie for one week and check if this coockie exist
thx for your help
To set cookie for 1 week
setcookie("cookiename","value",time()+7*24*3600);
To check it exists
if (isset($_COOKIE["cookiename"])) { //do something }
hth
how to set this cookie via a submit button
cause if i understand right the setcookie has to be before the header
thx
You are quite right. Setting cookies has to be done before any output is sent.
Place it at the top of your page
<?php get variables set cookie ?>
<http>
html code
</http>
thx but i wonder how to set it with my submit button, cause its for a survey and when the cookie is set the survey will be replace by the result
so i need to set it when the vote button was press and i have to execute the update query before
thx and scuse my english