I have a problems with cookies

General discussions related to php

Moderators: macek, egami, gesf

Post Reply
seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: I have a problems with cookies

Post by seandisanti » Tue Oct 23, 2012 3:08 pm

What exactly is going on that they're not working? a couple of things to watch for, that jump out at me just glancing over your code. 1) set expiration on cookies if you want them to persist after the browser closes. 2) when you set a cookie, it has to be the first output to the page like other headers. 3) Have you considered using session variables instead of cookies? You have a fair amount of cookies being stored on the client machine, you may actually benefit from using session variables to keep the data local to your server. If you've not played with session variables, check out jream.com, he's got a decent 5 minute session tutuorial that can help make sense of sessions even if you've never heard the term.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest