Hi,
I have a problem with solving a programming point.
I tried to solve it in many ways but I couldn’t

I have a system that each teacher has his username and password
Inside his profile he need to choose some students to make some groups lets say they a group for students who take mathematical language, to this point I have no problem

The problem is when I select all the students by using while loop and they displayed in the page, each student has a tick mark beside it to let the instructor select his name,

The number of students to be viewed is unknown, but it's viewed from database. Now, the instructor is checking the entire student he wants, by clicking a button the data should be save as all the group he checked, I really don’t know how to ask this, I'll try, How the check box for each student link with the student database to let me save it in other table, in other way, the select is retrieve the data and cant be linked with the new created check box. ( how can the check box know that this check is for that student)

This problem is confusing me, and I don’t know if there is a solving for it
Sana

hey, im not quite sure if i understood what you were asking, but i may have.

you could simply name the check boxes whatever the students names are.

so inside the tag that creates the box, say name = <?= echo $studentname ?>
then when the form is processed, it will know which box applies to which student.

or something along those lines. hope this helps.

Hi,
The problem is when I select all the students by using while loop and they displayed in the page, each student has a tick mark beside it to let the instructor select his name

I'm guessing you have a "key" for each student record in the database?

In your while loop you could do this

while ($array=mysql_fetch_array($qry)) {
etc etc
<input type=checkbox name=students[ ] value="<? echo $array["key"];?>">
Student Name
}

Then the form send an array called students, run a foreach on them and do as you please with them.

HTH

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.