<?php
if ($courses) {
    foreach ($courses as $v_course) {
        ?>
        <input  type="radio"
                data-errormessage-value-missing="Course Type is Required!" 
                class="form-control validate[required] text-input"
                name="course_id" id="course_id<?php echo $v_course->course_id; ?>" 
                value="<?php echo $v_course->course_id; ?>" 
                checked="1">

        <label for="<?php echo $v_course->course_name; ?>"><?php echo $v_course->course_name; ?></label>
        <input type="hidden" name="course_name<?php echo $v_course->course_id; ?>" id="course_name<?php echo $v_course->course_id; ?>" value="<?php echo $v_course->course_name; ?>">
        <input type="hidden" name="resource_person_id<?php echo $v_course->course_id; ?>" id="resource_person_id<?php echo $v_course->course_id; ?>" value="<?php echo $resource_person_info[$v_course->course_id]->resource_person_id; ?>">
        <input type="hidden" name="resource_person_name<?php echo $v_course->course_id; ?>" id="resource_person_name<?php echo $v_course->course_id; ?>" value="<?php echo $resource_person_info[$v_course->course_id]->person_first_name; ?>">
        <input type="hidden" name="course_name<?php echo $v_course->course_id; ?>" id="course_name<?php echo $v_course->course_id; ?>" value="<?php echo $v_course->course_name; ?>">
        <input type="hidden" name="course_time_duration<?php echo $v_course->course_id; ?>" id="course_time_duration<?php echo $v_course->course_id; ?>" value="<?php echo $v_course->class_hour_per_day; ?>">
        <input type="hidden" 
               name="course_last_session_number<?php echo $v_course->course_id; ?>" id="course_last_session_number<?php echo $v_course->course_id; ?>" 
               value="<?php
               if ($class_session_number[$v_course->course_id]) {
                   if ($class_session_number[$v_course->course_id]->class_session_number) {
                       echo $class_session_number[$v_course->course_id]->class_session_number;
                   }
               } else {
                   echo 0;
               }
               ?>">

        <div class="col-lg-12"><br></div>
        <span><br></span>

    <?php } ?>
    <input type="submit" class="btn btn-success" value="Add Course" data-dismiss="modal" onclick="setCourse();" >
<?php }else{ ?>
    <span><br>
        You do not have any Course in this Category
    </span>
<?php } ?>

