    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <div class="img-profile ml-3">

                    </div>
                    <h1 class="m-0 text-dark"><?php echo (isset($category)) ? 'Update Badge' : 'Add Badge' ?>
                    </h1>

                </div><!-- /.col -->
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="<?= base_url(); ?>dashboard/badges">Badge</a></li>
                        <li class="breadcrumb-item active"><?php echo (isset($category)) ? 'Update Badge' : 'Add Badge' ?></li>
                    </ol>
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.container-fluid -->
    </div>
    <?php
      if(isset($category)){
        $endpoint = 'updatebadge';
      }else{
        $endpoint = 'insertbadges';
      }
    ?>
    <form method="post" id="add_driver" class="card" action="<?php echo base_url() . "dashboard/".$endpoint; ?>" enctype="multipart/form-data">
        <!-- Main content -->
        <section class="content">
            <div class="container-fluid">
                <div class="card-body">


                    <div class="row">
                        <input type="hidden" name="id" id="id" value="<?=$id?>">

                        <div class="col-sm-6 col-md-6">
                            <label class="form-label">Badge Title<span class="form-required">*</span></label>
                            <div class="form-group">
                                <input type="text" name="title" id="title" class="form-control"
                                 placeholder="Badge Title" value="<?php echo $category['title'];?>">
                            </div>
                        </div>
                        <div class="col-sm-6 col-md-6">
                            <?php 
                                    // echo "<pre>";
                                    // print_r($category);
                                    // echo "</pre>";
                            ?>
                            <label class="form-label">Course List<span class="form-required">*</span></label>
                            <div class="form-group">
                                <select name="courses[]" id="courses" class="form-control multiselect" multiple>
                                    <?php
                                    
                                    foreach($courselist as $c=>$d){ 
                                       if(!in_array($c,$alreadyselected)){ 
                                        
                                        ?>
                                    <option <?php if(in_array($c,$category['courses'])){echo 'selected';} ?>   value="<?php echo  $c; ?>"><?php echo  $d; ?></option>
                                    <?php }  } ?>
                                </select>   
                            </div>
                        </div>
                        <div class="col-sm-6 col-md-6">
                            <div class="form-group">
                                <label class="form-label">Icon</label>
                                <input type="file" class="form-control" name="icon" placeholder="Icon">

                            </div>
                        </div>
                        <?php if($category['icon']) { ?>
                        <div class="col-sm-2 col-md-2 d-flex justify-content-center align-items-center">
                            <img class="img-responsive" src="<?=$category['icon']?>" width="75" height="75">
                        </div>
                        <?php } ?>

                    </div>

                </div>

            </div>
        </section>
        <!-- /.content -->


        <!-- Main content -->
        <section class="content">
            <div class="container-fluid">

                <div class="card-footer text-right">
                    <button type="submit" class="btn btn-primary"> <?php echo (isset($category)) ? 'Edit Badge' : 'Add Badge' ?></button>
                </div>
            </div>
        </section>
        <!-- /.content -->
    </form>