Page 1 of 1

A whole table full of checkboxes

Posted: Fri Jun 18, 2010 6:11 am
by john_st
Hi there. This is my first post, so please be gentle :)

I have a table with about 15 columns and a variable amount of rows. In each row, the first column is the name, and the rest are movies in which the actor starred. In the beginning there are just empty checkboxes.

Image

I would like to check the actors which starred in the first movie, then click on the button in that column and "remember" that somehow in my database. If the actor starred in a movie then that checkbox is replaced with a green check mark image, if not a red cross image is put in.

I worked out the part of checking in the database if there should be a green or red image, but I can't figure out the part of storing the checked checkboxes in the database. Can anybody help me?

Re: A whole table full of checkboxes

Posted: Sat Jun 19, 2010 12:17 pm
by andyhoneycutt
Could you show us the table schema for all this?

Re: A whole table full of checkboxes

Posted: Sun Jun 20, 2010 6:06 am
by john_st
Yes of course. These are my tables using mysql.

Actors:

Code: Select all

CREATE TABLE  actors
( actorID TINYINT NOT NULL AUTO_INCREMENT PRIMARY KEY 
, firstname VARCHAR( 30 ) NOT NULL 
, lastname VARCHAR( 30 ) NOT NULL
) ENGINE = INNODB;
Movies:

Code: Select all

CREATE TABLE  movies 
( movieID TINYINT NOT NULL AUTO_INCREMENT PRIMARY KEY 
, movie VARCHAR( 3 ) NOT NULL
, starred VARCHAR( 3 ) NOT NULL
) ENGINE = INNODB;
ActorsMovies:

Code: Select all

CREATE TABLE actor_movies 
( actorID TINYINT NOT NULL
, movieID TINYINT NOT NULL 
, PRIMARY KEY ( actorID, movieID )
, INDEX actor_movies ( movieID, actorID )
, FOREIGN KEY ( actorID ) REFERENCES actors ( actorID )
, FOREIGN KEY ( movieID ) REFERENCES movies ( movieID )
) ENGINE = INNODB;

Re: A whole table full of checkboxes

Posted: Mon Jun 21, 2010 9:59 am
by john_st
anybody? :(

Re: A whole table full of checkboxes

Posted: Mon Jun 21, 2010 3:23 pm
by McInfo
Is it important to you to have an OK button for each column?

Re: A whole table full of checkboxes

Posted: Thu Jun 24, 2010 6:43 am
by john_st
Well it' my original idea, but if it could be done easier without it I'm up for it.

I thougt that I would check the checkboxes for movie 1 and then click the button in that column. Then that "checkedness" and "uncheckedness" would go into the database, and when the page reloads, the button for that column would be gone, and the previously checked checboxes would be replaced by an image of a green check mark, and the unchecked ones with an image of a red cross.