View Full Version : Set Checkbox State

07-10-2009, 06:59 AM
OK. I need help please. My setup is so:
I have 3 SQL tables, a students table, with a column for either of their 8 classes, and a username column. the username is how i track users and the classes column is filled with the Class_ID when the user is added to the class. My second table is the Classes table. it contains a class_id column and a period column (there are 8 periods in the day, A1-A4, B1-B4). My third table is the teachers table that stores the Teacher_Username as well as a column for each of their periods, populated with the appropriate class_id

To add a student to a class, the Class_ID is placed into that students row in their appropriate period.

I need to add users, but I can't figure out the checkboxes (I manually added some test users). The page lists all students and a check box next to the user to change their class membership. the form page before it sets the current period and teacher_username.

I have queries to get the correct class_id by teacher_username and period from the teachers table, as well as to get the student username and period to be added to. (NOTE: A user is in the class when their period column value equals that of the Class_ID for that class).

What I need is if the user is in the class, the box is already checked. If they are not in the class, the box is unchecked, each student has a checkbox... Can anyone help me on this? Would my current code help?

Thanks so much!