you dont create a new physical file. On the classpage.php file, you create a recordset to look up the class by ID.
you would have one page that listed all of the classes with a link top the classpage.php file, that passes a querystring variable. The technique is reffered to as a master details page set:
3.) How could the student join to that classpage.php ?
I think you are missing some basic MySQL relational data concepts that will be needed to get this working.
in a mysql database, all of your tables will have a primary key column.
for the classes table, there will be a primary key column that uniquely identifies the class.
for the student table, there will be an ID column that uniquely identifies the student.
In MySQL you use these ID values to create relationships between the data.
there are 2 basic types of relationships:
1) One to Many
2) Many to Many
One to many relationships are pretty easy, but many to many relationships are more difficult.
With assigning students to classes, you are talking about a many to many relationship.
the idea with a many to many relationship is to create a linking table.
for example, if you have a students table:
studentID - Primary Key
studentName - text
and a classes table:
classID - Primary Key
className - text
you would need to create a studentClasses linking table:
studentClasssID - Primary Key
studentClassStudentID - relates to students.studentID
studentClassClassID - Relates to classes.classID
for the professor to assign students to the class, you needs to create a page where the professor selects the student, then selects the class and inserts the student ID and the Class ID to the studentClass table.
for the student to sign up for a class, when they login, their ID will be stored in a session variable, you need to set up a page where the student selects the class, then ID session variable and the Class ID are stored to the studentClass table.