Hi guys,
An authentication script which then extracts the user id entered by the user and then stores it in a cookie variable called $mycookie.
Further on into the site I am able to use the cookie to perform various select statements. Only problem is that php files that i have 'required' do not recieve or even recognise the $mycookie variable.
example: require("add.php");
So my select statements which end WHERE user_id='mycookie' simply do not function.
Please forgive me if im overlooking something very small, please point me in the right direction.
Many thanks.
passing cookie variables
Moderator: General Moderators
Re: passing cookie variables
usually cookies are done with JavaScript which then calls some PHP code on the web server to update the database that a cookie has been set etc
you will discover that there is a lot of interaction back and forth with PHP and JS
you will discover that there is a lot of interaction back and forth with PHP and JS
Hardcore Games™ Legendary is the Only Way to Play™
My site is powered by LAMP
My site is powered by LAMP
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: passing cookie variables
Read the manual about cookies: http://php.net/manual/en/features.cookies.php
Get cookie values in PHP from the $_COOKIE global. Use the setcookie() and setrawcookie() functions to set cookies.
Get cookie values in PHP from the $_COOKIE global. Use the setcookie() and setrawcookie() functions to set cookies.
(#10850)