A form on another page posts to this updater.php page. I am trying to take some info from a group of checkboxes and insert them into a db.
updater.php
$privileges = $_POST['privileges'];
$N = count($privileges);
$conn = $GLOBALS['conn'];
$empID = $_POST['empID'];
for($i=0; $i<$N; $i++)
{
$deptID = $privileges[$i];
$query = "INSERT INTO employee_department (employeeID, departmentID)
VALUES (':empID', ':deptID')";
$smt = $conn->prepare($query);
$smt->bindParam(':empID', $empID);
$smt->bindParam(':deptID', $deptID);
$smt->execute();
}
This code will work if I replace the placeholders with constants or if I replace them with$empID and $deptID. So I think the only thing that isn't working is where I'm trying to bind parameters to the placeholders. Thanks for any help!