<?php include('site-header.php'); ?>

  <!-- end of LOGO CONTAINER -->

  <!-- - - - - - - - - - - - - -->

  <!-- start of SIDEBAR        -->

  <!-- - - - - - - - - - - - - -->

  <?php include('left-nevigation.php'); ?>

  <!-- - - - - - - - - - - - - -->

  <!-- end of SIDEBAR          -->

  <!-- - - - - - - - - - - - - -->

  <main id="playground">

  <script src="ckeditor/ckeditor.js"></script>

    <!-- - - - - - - - - - - - - -->

    <!-- start of TOP NAVIGATION -->

    <!-- - - - - - - - - - - - - -->

    <nav class="navbar navbar-top navbar-static-top">

      <div class="container-fluid">

        <!-- sidebar collapse and toggle buttons get grouped for better mobile display -->

        <div class="navbar-header nav">

          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-top"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>

        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->

        <div class="collapse navbar-collapse" id="navbar-top">

          <ul class="nav navbar-nav navbar-right">

            <li class="dropdown user-profile"> <a href="logout.php" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">

              <div class="user-img-container"> <img src="demofiles/demoimage.gif" alt=""> </div>

              Sign Out <span class="chat-status success"></span> </a> </li>

          </ul>

        </div>

      </div>

      <!-- end of container-fluid -->

    </nav>

    <!-- - - - - - - - - - - - - -->

    <!-- end of TOP NAVIGATION   -->

    <!-- - - - - - - - - - - - - -->

    <!-- PAGE TITLE -->

    <!-- Php code -->

    <?php

    $id = mysqli_real_escape_string($link,$_GET['edit_cate']);

    extract($_POST);

    if(isset($upd))

    {

      $

      $cname = $catename;

      $sel = "update tbl_category_home set category='$category' where id=$id;";

      if(mysqli_query($link,$sel))

      {

        echo "<script>location.href='update-home-product.php';</script>";

      }

      else

      {

        $msg = "<p style='color:red;'>Category Already Exits!!!</p>";

      }

    }

    ?>

    <!-- Product edit -->

    <?php

    $id = mysqli_real_escape_string($link,$_GET['edit_ser']);

    extract($_POST);

    if(isset($upd_pro))

    {

      echo $tmp = $_FILES['att']['tmp_name'];

      echo $fnn = $_FILES['att']['name'];

      if($_FILES['att']['name']!="")

      {

        $sel = "update tbl_pro_home set pro_category='$pro_category',pro_name='$pro_name', pro_image='$fnn' where pro_id=$id;";

        if(mysqli_query($link,$sel))

        {

          move_uploaded_file($tmp, "../home-product/$fnn");

          echo "<script>location.href='update-home-product.php?message=successfully update!!!!';</script>";

        }

        else

        {

          $msg1 = "<p style='color:red;'>Category Already Exits!!!</p>";

        }

      }

      else

      {

        $sel = "update tbl_pro_home set pro_category='$pro_category',pro_name='$pro_name' where pro_id=$id;";

        if(mysqli_query($link,$sel))

        {

          echo "<script>location.href='update-home-product.php?message=success fully update!!!';</script>";

        }

      }

    }

    ?>

    <!-- delete Category -->

    <?php

    if(isset($_GET['del']))

    {

      $id = $_GET['del'];

      if(mysqli_query($link,"delete from tbl_category_home where id=$id"))

      { 

        echo "<script>location.href='update-home-product.php';</script>";

        $msg = "<p style='color:red;'>Delete Category!!!</p>";

      }



    }



    ?>

    <!-- /php code -->

    <section id="page-title" class="row">

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

        <h1>Dashboard</h1>

        <p class="lead">Update Home product</strong>.</p>

      </div>

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

        <ol class="breadcrumb pull-right no-margin-bottom">

         

          <li><a href="dashboard.html">Dashboard</a></li>

          <li class="active">Update Product</li>

        </ol>

      </div>

    </section>

    <div class="container-fluid">

      <div class="row" style="background-color:#1a2a42; color:black;">

        <div class="col-md-8" style="border:1px solid black;">

          <?php

          $id = $_GET['edit_ser'];

          if(isset($_GET['edit_ser']))

          {

            $sel = mysqli_query($link,"select * from tbl_service_desc where ser_id=$id");

            $arr = mysqli_fetch_assoc($sel);

          ?>

          <form method="post" enctype="multipart/form-data">

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

                <label>Description:</label>

                <textarea id="ckeditor1" name="ser_desc"><?=$arr['ser_desc'];?></textarea>

                <br>

                <label>Service:</label>

                <select class="form-control" name="pro_category">

                   <option>select service</option>

                 <?php

                  $sel = mysqli_query($link,"select * from tbl_service_home");

                  while($arr = mysqli_fetch_assoc($sel))

                  {

                  ?>

                   <option><?=$arr['ser_name'];?></option>

                  <?php

                  }

                  ?>

               </select>

               <br>

               <input type="submit" name="Product" value="Update" class="btn btn-primary form-control">

              </div>

          </form>

          <?php

          }

          ?>

        </div>

        <?php

        if(isset($_GET['edit_cate']))

        {

          

          $sel = mysqli_query($link,"select * from tbl_category_home where id=$id");

          $arr = mysqli_fetch_assoc($sel);

        ?>

        <form method="post">

          <div class="col-md-4" style="border:1px solid black;">

            

            <div><?=$msg;?></div>

            <div class="row">

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

              <table class="table-responsive table border">

                <thead>

                  <th>Category</th>

                  <th>Action</th>

                </thead>

                <tbody>

                  <td><input type="text" name="category" value="<?=$arr['category'];?>"></td>

                  <td><input type="submit" name="upd" value="Update" class="btn btn-success"></td>

                </tbody>

              </table>

            </div>

          </div>

         

          </div>

        </form>

         <?php

          }

          ?>

      </div>

    </div>

    <script>

      CKEDITOR.replace(ckeditor1)

      CKEDITOR.replace(ckeditor2)  

    </script>

    <!-- / container-fluid -->

 <?php include('site-footer.php'); ?>