/home/hdwebsolution/www/ns-interior/admin-pages/update-blogs.php
<?php include('site-header.php'); ?>
  <!-- end of LOGO CONTAINER -->
  <!-- - - - - - - - - - - - - -->
  <!-- start of SIDEBAR        -->
  <!-- - - - - - - - - - - - - -->
  <?php include('left-nevigation.php'); ?>
  
  <!-- - - - - - - - - - - - - -->
  <!-- end of SIDEBAR          -->
  <!-- - - - - - - - - - - - - -->
  <main id="playground">
    <!-- - - - - - - - - - - - - -->
    <!-- start of TOP NAVIGATION -->
    <!-- - - - - - - - - - - - - -->
 <?php include('site-top-header.php'); ?>

    <!-- - - - - - - - - - - - - -->
    <!-- end of TOP NAVIGATION   -->
    <!-- - - - - - - - - - - - - -->
    <!-- PAGE TITLE -->
    <?php
    $id = mysqli_real_escape_string($link,$_GET['del']);
    $sel = mysqli_query($link,"select * from tbl_services_product where pro_id=$id");
    $arr = mysqli_fetch_assoc($sel);
    if(isset($_GET['del']))
    {
        $image = $arr['pro_image'];
        $id = $_GET['del'];
        if(mysqli_query($link,"DELETE FROM `tbl_services_product` WHERE pro_id=$id"))
        {
          unlink("../product-image/$image");
          echo "<script>window.location.href='show-product.php';</script>";
        }
    }
    ?>
    <?php
    extract($_POST);
    if(isset($Add))
    {
      $hid = $_POST['hid'];
         if(mysqli_query($link,"update tbl_services_product set status='$Add' where pro_id='$hid'"))
          {
            $msg= "<p style='color:green;'>Product Add Home Page!!!!</p>";
          }
    }
     if(isset($Remove))
    {
      $hid = $_POST['hid'];
      if(mysqli_query($link,"update tbl_services_product set status='$Remove' where pro_id='$hid'"))
      {
        $msg= "<p style='color:red;'>product Remove!!!!</p>";
      }
    }
    ?>
     <?php
    extract($_POST);
    if(isset($gal_rem))
    {
        $hid = $_POST['hid'];  
        if($_POST['gal_rem']=="Gallery"){
         if(mysqli_query($link,"update tbl_services_product set status_gal='$gal_rem' where pro_id='$hid'"))
          {
            $msg= "<p style='color:white;'>Product Add Gallery Page!!!!</p>";
          }
      }else
      {
        if(mysqli_query($link,"update tbl_services_product set status_gal='$gal_rem' where pro_id='$hid'"))
          {
            $msg= "<p style='color:white;'>Product Add Gallery Page!!!!</p>";
          }
      }
    }
    ?>
    <section id="page-title" class="row">
      <div class="col-md-8">
        <h1>Show Blogs</h1>
        <p class="lead">Update your Blogs</strong>.</p>
      </div>
      <div class="col-md-4">
      </div>
    </section>
    <!-- / PAGE TITLE -->
    <div class="container-fluid">
      <div class="row">
        <div class="col-md-4">
          <section class="panel tasks-widget"></section>
        </div>
        <div class="col-md-4">
          <div class="panel-body"> <form method="post">
             <div class="form-group text-center"><a href="add-blogs.php" class="btn btn-primary">Add New Blogs</a>&nbsp;<!-- <a href="best-sell.php" class="btn btn-primary">Best Sell</a> --></div>
          </form>
          </div>
        </div>
        <div class="col-md-4">
          <section class="panel tasks-widget"></section>
        </div>
      </div>
      <!-- / row -->
      <div class="row">
        <div class="col-md-12">
          <section class="panel panel-primary">
            <header class="panel-heading">
              <h3 class="panel-title">Existing Product</h3>
            </header>
            
            <table class="table table-hover table-responsive" width="100%">
            <tbody>
              <tr>
                <th scope="row" style="color:black;">S. No</th>
                <th style="color:black;">Product Name</th>
                <!--<th style="color:black;">Category Name</th>-->
                <th style="color:black;">Image</th>
                <!-- <th style="color:black;">Add Image</th> -->
                <th style="color:black;">Add Home </th>
                <!-- <th style="color:black;">Add PDF</th> -->
                <th style="color:black;">Date</th>
                <th style="color:black;">Action</th>
              </tr>
              <?php
                $sn=0;
                $ReadSql = "select * from tbl_services_product ORDER BY pro_id DESC ";
                $sel = mysqli_query($link,$ReadSql);
              while($arr = mysqli_fetch_assoc($sel))
              {
                $cate_id=$arr['pro_category'];
                $sel1 = mysqli_query($link,"select * from tbl_category where cat_id=$cate_id");
                $arr1 = mysqli_fetch_assoc($sel1);
                $sn++;
              ?>
              <tr id="<?=$arr['pro_id'];?>">
                  <td><?=$sn?></td>
                  <td><?=$arr['pro_name'];?></td>
                  <!--<td><?=$arr1['cate_name'];?></td>-->
                  <td><img src="../product-image/<?=$arr['pro_image'];?>" alt="<?=$arr['pro_image'];?>" style="width:100px; height:100px;"></td>
                  <!-- <td><a href="product-image.php?pro_id=<?=$arr['pro_id'];?>" class="btn btn-success">Add Image</a></td> -->
                  <!-- <td><a href="product-pdf.php?pro_id=<?=$arr['pro_id'];?>" class="btn btn-success">Add PDF</a></td> -->
                 <td>
                    <?php
                    if($arr['status']=="Home")
                    {
                    ?>
                    <form method="post">
                      <input type="hidden" name="hid" value="<?=$arr['pro_id'];?>">
                      <input type="submit" name="Remove" value="Remove" class="btn btn-danger">
                    </form>
                    <?php
                    }
                    else
                    {
                    ?>
                    <form method="post">
                      <input type="hidden" name="hid" value="<?=$arr['pro_id'];?>">
                      <input type="submit" name="Add" value="Home" class="btn btn-success">
                    </form>
                    <?php
                    }
                    ?>
                  </td>
                 <!-- <td>
                    <?php
                    if($arr['status_gal']=="Gallery")
                    {
                    ?>
                    <form method="post">
                      <input type="hidden" name="hid" value="<?=$arr['pro_id'];?>">
                      <input type="submit" name="gal_rem" value="Remove" class="btn btn-danger">
                    </form>
                    <?php
                    }
                    else
                    {
                    ?>
                    <form method="post">
                      <input type="hidden" name="hid" value="<?=$arr['pro_id'];?>">
                      <input type="submit" name="gal_rem" value="Gallery" class="btn btn-success">
                    </form>
                    <?php
                    }
                    ?>
                  </td> -->
                  <td><?=$arr['pro_date']?></td>
                  <td><a class="btn btn-success"  href="add-blogs.php?edit=<?=$arr['pro_id']?>">Edit</a>&nbsp;<a class="btn btn-danger" href="?del=<?=$arr['pro_id']?>">Delete</a></td>
              </tr>
              <?php
              }
              ?>
          </tbody>
            </table>
          </section>
        </div>
      </div>
    </div>
    <!-- / container-fluid -->
 <?php include('site-footer.php'); ?>