views:

119

answers:

5

Hello

I'm trying to think of a way to create a list of items that I can display on a webpage that my visitors can tick off, without ever having to log in.

The list may be like so:

[ ]   Buy potatoes
[ ]   Pickup kids
[x]   Drink more water
[ ]   Go for a Run

If User A visits the site, and clicks "Drink More Water" I want that to save in a database so that when User B visits, "Drink More Water" is already ticked.

Is there any simple ways to do that:

  • in PHP?
  • with Javascript?
  • or even as a WordPress plugin?

Do you know if there's any existing code around that does this?

TaDa List by 37Signals comes very close, but only allows specific people to tick things off.

Any suggestions would be greatly appreciated.

Thanks Turgs

A: 

Just store that information in cookies. $_COOKIE['ticket'] = 3;

when he visit the page next time just check if $_COOKIE['ticket'] is not empty.

martin.malek
That won't work for UserA userB scenarios
Pim Jager
+4  A: 

Hey Tim,

If you want to create this yourself you should learn PHP and MySQL (and possibly Javascript (for AJAX)), and HTML and CSS (maybe you already know some of these). After you know these it will become clear how to create this.

You should first learn HTML
then PHP
then MySQL (or any SQL that works with PHP)
then CSS
Then Javascript

We can't really answer your question like this, because it involves big amounts of code. Adn won't really help you if you don't know these languages.

Pim Jager
+1  A: 

I'll tell you what you need to do, but you're going to have to research most of the things.

  1. You need html to create the list.
  2. You need php to query sql and check if one of them should be checked or not.
  3. Load the page with the data you got from your database server (set the checked ones as checked).
  4. When the user checks one of them you need to store it in the database, so that when another user loads the page he can then get the changes from the database.

Hope this is clear enough.

Daryl
A: 

You could do this kind of thing with a file instead of a database. So when the user checks off a box, it loads a PHP file that reads an XML file with the tasks and check-status, then re-writes that file with the modified value.

It's quick, dirty, and doesn't need a database.

St. John Johnson
It also has a load of possible errors, with multiple instances of the script trying to write to the file simultaniously
Pim Jager
Turgs seems to be a novice, in which case a database is likely easier to work with. @Pim Jager: On the other hand, if it is the case that he is a novice, he isn't likely dealing with a high traffic scenario in which case issues caused by concurrent file access shouldn't be a problem.
Justin Johnson
A: 

You could use a REST like url that defines a list. i.e.: http://ticklist.com/list/145
People can share this common list.

Something like the logic of http://friendpaste.com
To let people share and edit source codes.

Mic