Hi,
Bit of a pickle. Please advise a learner.
I have a page which displays records of data each with a checkbox field:
<input name=\"persselected[]\" type=\"checkbox\" value=\"$personid\" onClick=\"cnfToggle(this);cnfCountSelectedPersons(document.personentry);\">
Code at the top of my page takes the value of the value of persselected[] when the submit button is pressed:
if (isset($POST['submitpersons'])) {
$selectedpers = implode(",", $POST['persselected']);
$success = EnterPersons($selectedpers );
echo $success;
}
The problem I am having ( i think) is with my Function. I need it to insert how ever many records/checkboxs are selected. At the moment, it only inserts one record:
function EnterPersons($personid) {
$sqlquery = "INSERT INTO mytable (field1, field2, field3)
VALUES ($personid, 0, 0)";
$result = mysql_query($sqlquery, $_SESSION['S_REMOTE_DB']);
if ($result) {
$blnresult = true;
} else {
$blnresult = false;
}
return $blnresult;
Can someone please point out what I am missing and where it should go?
Thanks in advance.
}