|
-
May 14th, 2005, 01:43 PM
#1
Thread Starter
Lively Member
[resolved] setcookie, more than one variable?
Hello all.
How would I go about setting another name-value pair within a cookie? I can't figure out the correct syntax. So far I have:
Code:
setcookie("user_id", '.$row->user_id.', time()+86400);
Any help is greatly appreciated.
Last edited by solitario; May 27th, 2005 at 02:53 PM.
-
May 14th, 2005, 03:16 PM
#2
Fanatic Member
Re: setcookie, more than one variable?
why not just set a cookie array?
PHP Code:
<?php
// set the cookies
setcookie("cookie[three]", "cookiethree");
setcookie("cookie[two]", "cookietwo");
setcookie("cookie[one]", "cookieone");
// after the page reloads, print them out
if (isset($_COOKIE['cookie'])) {
foreach ($_COOKIE['cookie'] as $name => $value) {
echo "$name : $value <br />\n";
}
}
?>
-
May 15th, 2005, 01:11 AM
#3
Thread Starter
Lively Member
Re: setcookie, more than one variable?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|