<?php
if ($first_column_selected_data) {
    echo '<div class="col-sm-12">';
    foreach ($first_column_selected_data as $value) {
        $id = $value->course_id;
        ?>
        <div class="col-sm-4">
            <div class="checkbox checkbox-success">
                <input type="checkbox"
                       onchange="checkIDStatus(this.value)"
                       id="id<?php echo $id; ?>" 
                       class="styled"
                       name="id[]"
                       value="<?php echo $id; ?>" checked >
                <label for="" class="text-justify" ><?php echo $value->course_name; ?></label>
            </div>
            <div class="col-sm-12" style="color: red" id="checkbox_error<?php echo $id; ?>"></div>
        </div>
        <?php
    }
    echo ' </div>';
}

if ($second_column_selected_data) {
    echo '<div class="col-sm-12">';
    foreach ($second_column_selected_data as $value) {
        $id = $value->course_id;
        ?>
        <div class="col-sm-4">
            <div class="checkbox checkbox-success">
                <input type="checkbox"
                       onchange="checkIDStatus(this.value)"
                       id="id<?php echo $id; ?>" 
                       class="styled"
                       name="id[]"
                       value="<?php echo $id; ?>" checked>
                <label for="" class="text-justify" ><?php echo $value->course_name; ?></label>
            </div>
            <div class="col-sm-12" style="color: red" id="checkbox_error<?php echo $id; ?>"></div>
        </div>
        <?php
    }
    echo ' </div>';
}

if ($first_column_data) {
    echo '<div class="col-sm-12">';
    foreach ($first_column_data as $value) {
        $id = $value->course_id;
        ?>
        <div class="col-sm-4">
            <div class="checkbox checkbox-success">
                <input type="checkbox"
                       onchange="checkIDStatus(this.value)"
                       id="id<?php echo $id; ?>" 
                       class="styled"
                       name="id[]"
                       value="<?php echo $id; ?>" >
                <label for="" class="text-justify" ><?php echo $value->course_name; ?></label>
            </div>
            <div class="col-sm-12" style="color: red" id="checkbox_error<?php echo $id; ?>"></div>
        </div>
        <?php
    }
    echo ' </div>';
}

if ($second_column_data) {
    echo '<div class="col-sm-12">';
    foreach ($second_column_data as $value) {
        $id = $value->course_id;
        ?>
        <div class="col-sm-4">
            <div class="checkbox checkbox-success">
                <input type="checkbox"
                       onchange="checkIDStatus(this.value)"
                       id="id<?php echo $id; ?>" 
                       class="styled"
                       name="id[]"
                       value="<?php echo $id; ?>" >
                <label for="" class="text-justify" ><?php echo $value->course_name; ?></label>
            </div>
            <div class="col-sm-12" style="color: red" id="checkbox_error<?php echo $id; ?>"></div>
        </div>
        <?php
    }
    echo ' </div>';
}

if ($third_column_data) {
    echo '<div class="col-sm-12">';
    foreach ($third_column_data as $value) {
        $id = $value->course_id;
        ?>
        <div class="col-sm-4">
            <div class="checkbox checkbox-success">
                <input type="checkbox"
                       onchange="checkIDStatus(this.value)"
                       id="id<?php echo $id; ?>" 
                       class="styled"
                       name="id[]"
                       value="<?php echo $id; ?>" >
                <label for="" class="text-justify" ><?php echo $value->course_name; ?></label>
            </div>
            <div class="col-sm-12" style="color: red" id="checkbox_error<?php echo $id; ?>"></div>
        </div>
        <?php
    }
    echo ' </div>';
}