PHP cookie gets deleted on page change?
Get the solution ↓↓↓Solution:
This problem could be solved by adding the domain name at the end
setcookie('cookie1',"121",strtotime( '+30 days' ),"/",$_SERVER['SERVER_NAME']);
The domain that the cookie is available to. Setting the domain to 'www.example.com' will make the cookie available in the www subdomain and higher subdomains. Cookies available to a lower domain, such as 'example.com' will be available to higher subdomains, such as 'www.example.com'. Older browsers still implementing the deprecated » RFC 2109 may require a leading . to match all subdomains.
Answer
Solution:
try this
setcookie('cookie1',"121",time()+2592000,"/");//30 days equals 2592000 seconds
Answer
Solution:
Are you sure your own browser is storing cookies? take a look to your browset privacy settings.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: a non-numeric value encountered
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.