homepage Welcome to WebmasterWorld Guest from 50.17.107.233
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Accredited PayPal World Seller

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
How to get the value of a Cookie?
How to get the value of a Cookie?
nimonogi




msg:3626387
 1:11 pm on Apr 14, 2008 (gmt 0)

Hello,

How can i get the Value of a cookie?

Set the cookie:

setcookie("name", "value", time() - 3600);

Read the cookie:

(isset($_COOKIE["name"]))

I want to read the value not just the name.

Thanks in advance!

 

jatar_k




msg:3626401
 1:35 pm on Apr 14, 2008 (gmt 0)

try this to see what's in the cookie

echo '<pre>';
print_r($_COOKIE);
echo '</pre>';

Achernar




msg:3626619
 6:21 pm on Apr 14, 2008 (gmt 0)

$_COOKIE["name"] is the value

nimonogi




msg:3626655
 7:22 pm on Apr 14, 2008 (gmt 0)

This was easier than i thought :P

So, is this correct?

if (isset($_COOKIE["name"]))
{
$content = $_COOKIE["name"];
}

(If a cookies is set, $content gets its value)

jatar_k




msg:3626664
 7:32 pm on Apr 14, 2008 (gmt 0)

yes, it should be correct

try it and see

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved