Hi
In your opinion what is the best way to pass variables between pages?
I'm storing everything in $_COOKIE but it's really quite messy.
On the other hand I can't get $_SESSION or $_SERVER to work.
Has anybody written a definitive paper on how best to track variables between pages? It will be good for me to read that before I go too much further.
Chris
what is the best way to pass variables between pages?
Moderator: General Moderators
Re: what is the best way to pass variables between pages?
Depends on the situation; GET, POST, cookies, and sessions are all valid for some set of circumstances.
Though the session is generally easiest.
Though the session is generally easiest.
Oh really?cneeds wrote:On the other hand I can't get $_SESSION or $_SERVER to work.
Re: what is the best way to pass variables between pages?
Yes, I didn't realise I had to session_start at the top of every page. In my simple brain once it's started it runs til it stops. Not so says php, life can never be that simpletasairis wrote:Oh really?
Thank you for your time anyway
Chris
Re: what is the best way to pass variables between pages?
I resolved the problem by putting a path statement of "/" in my set cookie calls!!
Thanks for the help everyone.
Chris
Thanks for the help everyone.
Chris
Re: what is the best way to pass variables between pages?
You should look into session.auto_start in the php.ini file.