Select records from a table using checkbox

Hello All,
I have a weird requirement on a PHP app.

I have a table that is showing students that have taken a course in the past. The tables are setup like this
table 1: SCHEDULED COURSES
table 2: COURSE REGISTRATIONS (shows students that have registered for scheduled courses)
table 3: STUDENTS

The table right now shows students that took a specific scheduled course. All students get listed.
I need to tick each student that the instructor needs to print a card for (may or may not be all students) and then run a query to select only those students and export those to an excel spreadsheet.

Obviously its not as easy as doing a SELECT STUDENT ID because it needs to pull information specific to each course. I guess a LEFT JOIN would work but how to I work tick boxes into a query on the following page?

The html page showing the checkboxes would evolve from a join as you say.

You want student id and student name in order to output your check boxes eg:


<input type=checkbox name=students value=student[23] /> Barbara Streisand <br />

resulting from:


SELECT s.student_id as id, s.student_name as name
FROM students_table as s
LEFT JOIN course_registrations_table as r
ON s.students_id = r.students_id
ORDER BY students_name

Where my student_id fields are obviously the ones you want to join on. As you provided no db schema, I guessed some column names to illustrate.