<div class="row">

  <div class="col-lg-12 mt-4">

    <div class="card">

      <div class="card-header form-card-header">

        <h4 class="m-b-0 text-light">UPDATE ARTICLES </h4>

      </div>

      <div class="card-body">

        <form id="update_articles" class="form-material">

          <div class="form-body">

            <div class="row">

              <div class="col-md-12">

                <div class="form-group">

                  <label class="control-label"><strong>ARTICLE NAME <span>*</span></strong></label>

                  <input type="text" id="name" name="name" class="form-control" value="<?php echo $articles[0]->name; ?>">

                  <label for="name" class="error"></label> 

                </div>

              </div>



              <div class="col-md-12">

                <div class="form-group">

                  <label class="control-label"><strong>DESCRIPTION <span>*</span></strong></label>

                  <textarea name="description" id="description" rows="4" class="form-control"><?php echo $articles[0]->description; ?></textarea>

                  <label for="description" class="error"></label> 

                </div>

              </div>



              <div class="col-md-4">

                <div class="form-group">

                  <label class="control-label"><strong>UPLOAD IMAGE</strong></label>

                  <input type="file" name="image" id="image" class="form-control"/>

                  <label> Note : image size ( 227 x 163 pixels )</label>

                  <label for="image" class="error"></label> 

                  <div>

                    <?php 

                    if($articles[0]->filepath !== "NA"){

                      $url = base_url().$articles[0]->filepath;

                    }else{

                      $url = base_url().'public/custom/images/articles/default.jpg';

                    } ?>

                    <img src="<?php echo $url; ?>" height="250" width="250"></div>

                </div>

              </div>



              <div class="col-md-4">

                <div class="form-group">

                  <label class="control-label"><strong>ARTICLE DATE <span>*</span></strong></label>

                  <input type="text" id="article_date" name="article_date" class="form-control" value="<?php echo date("d-m-Y",strtotime($articles[0]->articleDate)); ?>" >

                  <label for="article_date" class="error"></label> 

                </div>

              </div>



              <div class="col-md-4">

                <div class="form-group">

                  <label class="control-label"><strong>STATUS</strong></label>

                  <select name="status" id="status" class="form-control">

                    <option value="1" <?php if($articles[0]->status == '1'){echo 'selected'; }?>>ACTIVE</option>

                    <option value="0" <?php if($articles[0]->status == '0'){echo 'selected'; }?>>DEACTIVE</option>

                  </select>

                  <label for="status" class="error"></label> 

                </div>

              </div>

              <div class="col-md-4">

                <div class="form-group">

                  <label class="control-label"><strong>UPLOAD PDF</strong></label>

                  <input type="file" name="pdfimage" id="pdfimage" class="form-control"/>

                  <!-- <label> Note : image size ( 227 x 163 pixels )</label> -->

                  <label for="pdfimage" class="error"></label> 

                  <div>

                    <?php 

                    if($articles[0]->pdfpath !== "NA"){

                      $url = base_url().$articles[0]->pdfpath;
                      $imgurl = base_url().'public/custom/images/articles/pdfimage.png';
                    }else{
                      $url = "#";
                      $imgurl = base_url().'public/custom/images/articles/pdfimage.png';

                    } ?>

                    <a href="<?php echo $url; ?>" target="_blank"><img src="<?php echo $imgurl; ?>" height="250" width="250"></a></div>

                </div>

              </div>

            </div>

          </div>

          

          <input type="hidden" id="id" name="id" value="<?php echo $articles[0]->id; ?>">

          <input type="hidden" id="imgpath" name="imgpath" value="<?php echo $articles[0]->filepath; ?>">

          <input type="hidden" id="pdfpath" name="pdfpath" value="<?php echo $articles[0]->pdfpath; ?>">


          <div class="form-actions">

            <button type="submit" class="btn btn-rounded btn-outline-success col-md-3">SAVE</button>  

            <button type="button" class="btn btn-rounded btn-outline-danger col-md-3" onclick="window.location.href='<?php echo base_url(); ?>articles/list'">CANCEL</button>  

          </div>

        </form>

      </div>

    </div>

  </div>

</div>