Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7063123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:40:35+00:00 2026-05-28T04:40:35+00:00

I would like to implement a save feature, which allows my users to save

  • 0

I would like to implement a “save” feature, which allows my users to save a particular entry that I have presented to them from my database. For example, if they see something they like, they can press the “save” button and it will save to a “bookmarks” page.

Here is my code:

<?php 

// Get all the data from the example table
$result = mysql_query("SELECT * FROM table WHERE item <> 0 ORDER BY id") 
or die(mysql_error());  

// keeps getting the next row until there are no more to get
$i = 10; 
while ($i > 0) {  
    $i--;
    $row = mysql_fetch_array( $result );
    if ($row['id'] != "" ) { 
?>

<!-- Some content in this div-->
<div class="content"> 
<img  src="<?php echo $row['logo']; ?>"/>
<?php echo $row['id']; ?>
</div>

<!-- This div will have the save icon that users can press --> 
<div class="save">
<img  src="images/saveIcon.png" />
</div>

<?php }} ?>

<div class="bookmarked"> 
Every single div that is labled as "content" that has been saved, will be displayed here. 
</div>

Question: How would I implement a feature to allow a user to add the particular ID from SQL (of the dynamically created content) to a cookie variable, so that it can be reproduced at a later time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:40:35+00:00Added an answer on May 28, 2026 at 4:40 am

    If I have understood your question correctly, you want a button which marks the related DIV, and stores this relation to cookies.

    First of all, I would add the id of entry as class to the DIV. Then you’ll have the possibility to get the id easily via javascript (for further implementations).

    To set the favorites via php, you should add a link to a new php script. This script sets the cookie, via the setcookie function in PHP.

    In your bookmarked-DIV you would make the same while-loop as above, but check the ids with the values in the cookies. You can access cookies with $_COOKIE. Just show items, which are containing in the cookies.

    This is a possible way of implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to implement a ORM-style system that can save updates to POJOs
I would like to implement a producer/consumer scenario that obeys interfaces that are roughly:
I would like to implement a post build event that performs the following actions
We would like to implement a web form that automatically saves content at regular
I have a complex Clojure data structure that I would like to serialize -
I have a thread that is doing some processing. I would like to be
I have a generic repository and would like to implement a generic GetById method.
I would like to implement a dialog in my App that behaves like the
I have a C#.NET web app and would like to save my underlying Model
I have have completed an application and would like to add a save button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.