How to link table “implode array in one cell” with foreign key?

Thank you for looking at this problem, details are all below.

Below is the code

<form style="overflow: hidden;" method="post">
    <input type="checkbox" aria-label="Checkbox for following text input" 
    name="kursus[]" value="<?php echo $row['IDKursus']; ?>">
    <div class="d-flex justify-content-between mt-3">
        <button type="submit" class="btn btn-success" name="daftar_kursus">Daftar Kursus</button>
        <button type="reset" class="btn btn-primary">Reset</button>
    </div>
</form>

if (isset($_REQUEST['daftar_kursus'])) {
    $IDKursus = implode(',', $_POST['kursus']);
    try {
        //Kursus
        $user = $_SESSION['pensyarah_login'];

        $query = "UPDATE pensyarah SET IDKursus = '$IDKursus' WHERE IDUser = '$user';";

        $sth = $db->prepare($query);
        $sth->execute();

        echo "nice";
    } catch (PDOException $e) {
        $e->getMessage();
    }
}

Screenshot Table Pensyarah
Screenshot_2022-12-21_210307.png

Screenshot Table Kursus
Screenshot_2022-12-21_210349.png

I hope to solve this problem soon. Thank you