ma<?php include 'inc/header.php'; ?>
<!-- ====== End Header ===== -->
<?php include 'inc/sidebar.php'; ?>
<?php

$id = $_GET['id'];
$a = "select * from management where id = '$id'";
$b = mysqli_query($con,$a);
$data = mysqli_fetch_array($b);


?>
<!-- ====== End Sidebar ===== -->    
   <!-- Main Content -->
      <div class="main-content">
        <section class="section">
          <div class="section-header">
            <div class="row">
              <div class="col-xl-6 col-lg-6 col-md-6 col-sm-12">
                <div class="section-header-breadcrumb-content">
                  <h1> Management</h1>
                  <div class="section-header-breadcrumb">
                    <div class="breadcrumb-item active"><a href="#"><i class="fas fa-home"></i></a></div>
                    <div class="breadcrumb-item"><a href="#">Service</a></div>
                    <div class="breadcrumb-item"><a href="#"> Management</a></div>
                  </div>
                </div>
              </div>
            
            </div>
          </div>
          <div class="row">
              <div class="col-12">
                 <?php if (isset($_SESSION['msg_scs'])): ?>
            <p class="alert alert-success"><?= $_SESSION['msg_scs'];?></p>
          <?php endif ?>
          <?php unset($_SESSION['msg_scs']);?>
         
          <?php if (isset($_SESSION['msg_err'])): ?>
            <p class="alert alert-danger"><?= $_SESSION['msg_err'];?></p>
          <?php endif ?>
          <?php unset($_SESSION['msg_err']);?>
                <div class="card">
                  <div class="card-header">
                    <h4>Management</h4>
                  </div>
                  <div class="card-body">
                  <form method="post" action="management_update.php" enctype="multipart/form-data">
              <?php
                $sql = "select * from category";
                $qry = mysqli_query($con,$sql);
                $option = "";
                while ($results = mysqli_fetch_array($qry)) 
                {
                    $option = $option."<option value='".$results['category']."'>$results[category]</option>";
                 }
                ?>
             
            <div class="form-group">
              <label>Category</label>
              <select name="category" class="form-control">
                 <?php echo $option;?>
              </select>
            </div>

              <?php
                $sql = "select * from sub_category";
                $qry = mysqli_query($con,$sql);
                $option = "";
                while ($results = mysqli_fetch_array($qry)) 
                {
                    $option = $option."<option value='".$results['sub_category']."'>$results[sub_category]</option>";
                 }
                ?>
            <div class="form-group">
              <label>Sub Category</label>
              <select name="sub_category" class="form-control">
              <?php echo $option;?>
          </select>
            </div>
            <div class="form-group">
              <label>Heading</label>
              <input type="text" name="heading" class="form-control" value="<?php echo$data['heading']?>">
            </div>
             <div class="form-group">
              <label>Image</label>
              <img src="<?php echo$data['image']?>" style="width: 100px;">
              <input type="file" name="image" class="form-control">
            </div>
        <div class="form-group">    
        <textarea name="content" class="form-control ckeditor">
          <?php echo$data['content']?>
        </textarea>
        <input type="hidden" name="id" value="<?php echo$data['id']?>">
    </div>
                      
       

          <button type="submit" class="btn btn-danger" name="update">Submit</button>
        </form>  
                  </div>
                </div>
              </div>
            </div>
       
            <br>
           

        
          </div>
        </div>
               
<?php include 'inc/footer.php'; ?>
<!-- ====== End Footer ===== --> 

