cookies to bookmark posts

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ninethousandfeet
Forum Contributor
Posts: 130
Joined: Tue Mar 10, 2009 4:56 pm

cookies to bookmark posts

Post by ninethousandfeet »

hi,

i am trying to figure out how i can allow the user to add as many bookmarked posts to a reference list. example, youtube uses this for their 'quicklist' feature. basically, i need to create a new cookie each time the user clicks the add button. a couple of things that are over my head on this problem:
- the add button needs to disappear next to that post as long as that cookie remains intact
- the reference list needs to reflect that 1 additional item is in it

i have a do...while loop for the posts. how can i create a unique cookie for each post in the loop?

so far i have something like this, but it doesn't work:

Code: Select all

 
<?php
$addbutton = image source code here;
$post = $row_post['post_info'];
$postNotOnList = $addbutton + $post;
 
do {
if ($_COOKIE['postID'] == '$row_post['postID']) {
echo $post;
} else {
echo $postNotOnList;
} while ($row_post = mysql_fetch_assoc)
?>
 
any ideas or help is greatly appreciated. thank you!
Post Reply