Not knowing your database structure it'd be hard to give accurate queries but this is what I'd do:
Then you'd get something like 1|2|4|8|16 as a list of courses associated to each use, that's how I'd arrange it.
PHP Code:
<?php
echo "<form method=\"post\" action=\"\">\n";
$query = mysqli_query($link, "SELECT * FROM `courses`;");
while($course = mysqli_fetch_assoc($query))
{
echo "<input type=\"checkbox\" name=\"courses[]\" id=\"{$course['name']}\" value=\"{$course['id']}\"> <label for=\"{$course['name']}\">{$course['name']}</label>\n";
}
echo "</form>\n";
if($_POST['courses'])
{
$list_of_courses = "";
foreach($_POST['courses'] as $course)
{
$course = htmlspecialchars($course);
$list_of_courses[] = $course;
}
$new_list_of_courses = implode("|", $list_of_courses);
$update = mysqli_query($link, "UPDATE `users` SET `courses` = '{$new_list_of_courses}' WHERE `user` = '{$whatever}';");
}
?>
Then you'd get something like 1|2|4|8|16 as a list of courses associated to each use, that's how I'd arrange it.
MyBB Support Team Lead