Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 12-25-2010, 05:54 PM php cookie variables
Novice Talker

Posts: 6
Trades: 0
I was wondering how to set and retrieve information from a cookie, where the information retrieved will be modified by a variable, for example if the cookie is 1, i want the next cookie to be 2, so can I add "+1"?

For example:

<?php
setcookie("count","1");
?>

and when the cookie is read I want to do like this:
<?php
if (isset($_COOKIE["count"]))
echo "new number" . $_COOKIE["count"]+1 . "!<br />";
else
echo "no numbers to add!<br />";
?>
ShadowHawk is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-25-2010, 08:04 PM Re: php cookie variables
Average Talker

Posts: 18
Name: David
Location: Sweden
Trades: 0
<?php
setcookie("count","1");
?>

<?php
if (isset($_COOKIE["count"])) {
$number = $_COOKIE['count] + 1;
setcookie("count", $number);

echo new number" . $number . "!<br />";
} else {
echo "no numbers to add!<br />";
}
?>
__________________

Please login or register to view this content. Registration is FREE
- View random youtube videos easily & instantly!


Please login or register to view this content. Registration is FREE
- Dubstep.nu recommends great dubstep songs everyday!
FlyHour is offline
Reply With Quote
View Public Profile Visit FlyHour's homepage!
 
Reply     « Reply to php cookie variables
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11081 seconds with 12 queries