Forum Moderators: coopster

Message Too Old, No Replies

Pulling data from a cookie

         

supermanjnk

2:10 am on Jul 20, 2004 (gmt 0)

10+ Year Member



Alright, If i have a cookie that have set up like
this
setcookie("testcookie", $test, time()+86400);

Where $test is a dynamic value (like a username)

is it possible to then

somehow extract the value from the cookie, without actually inputing the value and store it somewhere

if (!isset($_COOKIE["value"])) would this pull that? and if so how would i then store the value of the cookie somewhere? say store it into something like
$test =

Thanks for any help you give.

CodeLabMaster

3:12 am on Jul 20, 2004 (gmt 0)



if(isset($_COOKIE["uname"])) {
$user = $_COOKIE["uname"];
echo "Welcome back $user";
} else {
echo "Hello visitor, be sure to register.";
}

Let's take a look at line one...

if(isset($_COOKIE["uname"])) {

This Line tests to see if the cookie is there. The next line...

$user = $_COOKIE["uname"];

...stores the cookie in a variable.

I hope this helps and I'm sorry about the grammer, I havn't had sleep in 20 hours.