<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)) ? 'Edit Sub Category' : 'Add Sub Category' ?>
                    </h1>

                </div><!-- /.col -->
            
            </div><!-- /.row -->
        </div><!-- /.container-fluid -->
    </div>
    <?php
      if(isset($category)){
        $endpoint = 'updatesubcategory';
      }else{
        $endpoint = 'insertsubcategory';
      }
    ?>
    <form method="post" id="add_driver" class="card" action="<?php echo base_url() . "dashboard/".$endpoint; ?>">
        <!-- Main content -->
        <section class="content">
            <div class="container-fluid">
               


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

                        <div class="col-sm-12 col-md-12">
                            <label class="form-label">Title<span class="form-required">*</span></label>
                            <div class="form-group">
                                <input type="text" name="name" id="title" class="form-control" placeholder="Category Title"
                                 value="<?php echo $category['name'];?>">
                            </div>
                        </div>
                        <br><br>
                        <div class="col-sm-12 col-md-12">
                            <label class="form-label">Category<span class="form-required">*</span></label>
                            <div class="form-group">
                                <select class="form-control" name="categoryId" required>
                                        <?php foreach($categories as $c =>$t){ ?>    
                                        <option value="<?php echo $c; ?>" <?php if($category['categoryId']==$c){echo 'selected';} ?>><?php echo $t['name']; ?></option>
                                        <?php } ?>
                                </select>   
    
                            </div>
                        </div>
                        <br><br>

                        <div class=" col-sm-12 col-md-12 text-right">
                        <br><br>
                        <button type="submit" class="btn btn-primary"> <?php echo (isset($category)) ? 'Edit Subcategory' : 'Add Subcategory' ?></button>
                        <br><br>
                        </div>

                      </div>

         

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


    </form>