construct INSERT SQL Statement from checkboxes

I have a control that retrievs student’s IDs in the format of checkboxes. I select a number of these students and from the selected checkboxes create an insert SQL statement. Ofcourse the insert sql statement will have other data. my problem is how to get all the selected checkboxes ( preferably put them into an array) & construct an insert statement.
any help would be appreciated

checkboxes.png

??, have your tried to show onscreen the value of your checkbox field?.

Commonly a checkbox field creates a list of values something like

“1,2,3,4,5,6,7,8”

being those numbers the id’s of your students… in this case… all you need to do to save it in an array is to use the “explode” php command.

take a look at this

http://php.net/manual/en/function.explode.php

Regards.

Yeah i had already figured it out. Thanks tho…for the benefit of others here’s how i did it

[I]$arr = explode ( “,”, {StudentID} );

$querry = “INSERT INTO ClassProgress (studentsID,ClassYear,FeesID,ClassID,Comment,Term) VALUES (”;

foreach ($arr as $value)
{
$querry .= $value .",".{ToYear}.",".{FeesID}.",".{ClassIDTo}.","."’{Comment}’".",".’{ToTerm}’."),(";
}

$querry = substr($querry,0,-2);
echo "Queryy is : $querry<br />
";

//sc_exec_sql($querry);[/I]

I have commented sc_exec_sql($querry) cos i wanted to see the insert SQL generated…