OnClick MySQL database update

This project is now closed with a project budget of N/A.

Get free quotes for a project like this
Employer working
Skills Required
Project Budget
Project Description

I run a PHP/MySQL web database. I would like to include a tickbox on a dynamically generated page so that users can track whether the item represented on that page is within their collection. After a JavaScript onclick trigger, this should then:

1, update the database similar to below:

INSERT INTO collection (user_id, item_id)
VALUES ($_SESSION[id], $_GET[id])

... where $_SESSION[id] is the ID of the logged on user, 1 indicates it is in their collection and $_GET[id] is the item that is being marked as part of the user's collection.

2. If the tickbox is already ticked and they wish to remove it from their collection it would instead do:

DELETE FROM collection WHERE user_id = $_SESSION[id] AND item_id = $_GET[id] LIMIT 1

3. The tickbox image should automatically update to ticked or unticked status according to whether it is in the user's collection after the onclick trigger.

IMPORTANT: This should be done without reloading the page (presumably by AJAX.)

Examples of similar functionality can be found at Amazon (you can add items to your wishlist in this way) or at

Access to our web code will be made available to successful bidder via Plesk.

The rest of this page is already written - this is simply adding the above functionality. I will create a suitable MySQL table in advance.

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online