<?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 -->
<!-- - - - - - - - - - - - - -->
<?php include('site-top-header.php'); ?>
<!-- - - - - - - - - - - - - -->
<!-- end of TOP NAVIGATION   -->
<!-- - - - - - - - - - - - - -->
<!-- PAGE TITLE -->
<?php
extract($_POST); 

   if(isset($_REQUEST['Insert']))
   {
    $sqlinsrt ="INSERT INTO `tbl_faq`(`faq_name`, `faq_dase`) VALUES ('$faq_name','$faq_dase')";
      if(mysqli_query($link,$sqlinsrt))
      {
        $msg = "<p style='color:green;'>Add on list Successfully...</p>";
      }
      else
      {
         $msg = "<p style='color:red;'>Not inserted...</p>";
      }
   }
   ?> 
<?php
   if(isset($_REQUEST['Updt']))
   {
      $sqlinsrt ="UPDATE `tbl_faq` SET 
                `faq_name`='$faq_name',
                `faq_dase`='$faq_dase'
                 WHERE id='$_REQUEST[faq_id]'";
      if(mysqli_query($link,$sqlinsrt))
      {
        $msg = "<p style='color:green;'>Update Successfully...</p>";
      }
      else
      {
         $msg = "<p style='color:red;'>Not Update...</p>";
      }
   }
   ?> 

<?php 
   if($_REQUEST['faq_del_id']!="")
   {
   $faq_del_id=$_REQUEST['faq_del_id'];
   $sql_del ="DELETE FROM `tbl_faq` WHERE id='$faq_del_id'";
  
   if(mysqli_query($link,$sql_del))
      {
        $msg = "<p style='color:green;'>Delect Successfully...</p>";
      }
      else
      {
         $msg = "<p style='color:red;'>Not Delect...</p>";
      }
   }
   ?>
<?php
   $sql="SELECT * FROM `tbl_faq` ORDER by id DESC";
   $data=mysqli_query($link,$sql);
   $count=mysqli_num_rows($data);
   ?>     
<section id="page-title" class="row">
   <div class="col-md-8">
      <h1>FAQ </h1>
      <p class="lead">Update your FAQ </strong>.</p>
      <?=@$msg1;?>
   </div>
   <div class="col-md-4">
    
   </div>
</section>
<!-- / PAGE TITLE -->
<div class="container-fluid">
   <div class="row">
      <?php
      $sn=2; 
      while($result=mysqli_fetch_array($data)){ 
        ?>
      <form enctype="multipart/form-data" method="post">
         <div class="col-md-6">
          <label>faq Title:</label>
            <input type="text" value="<?=$result['faq_name'];?>" name="faq_name" class="form-control"> 
            <label>faq Description:</label>
            <textarea id="ckeditor<?=$sn;?>" name="faq_dase" rows="5" cols="45">
             <?=$result['faq_dase'];?>
            </textarea>
            <input type="hidden" name="faq_id" value="<?php echo $result['id'] ?>">
            <div class="text-center">
              <button class="btn btn-primary" name="Updt" style="width:100%;">Update</button> 
            </div>
      </form>
      <form method="post">
       <input type="hidden" name="faq_del_id" value="<?php echo $result['id'] ?>">
      <div class="text-center"><button class="btn btn-primary" name="del" style="width:100%;">Delete</button> </div> 
      </form>
      </div>
      <?php $sn++;} ?>
   </div>
   <!-- / row -->
</div>
<?php if($count>=48){ 
   echo "";
   }else{
   ?>
<div class="container-fluid" style="margin-top:80px;">
   <div class="row">
      <div class="col-md-4">
      </div>
      <form method="post" enctype="multipart/form-data">
         <div class="col-md-6">
             <label>faq Title:</label>
            <input type="text"  name="faq_name" class="form-control" placeholder="Title"> 
            <label>faq Description:</label>
            <textarea  id="ckeditor1" name="faq_dase" rows="5" cols="45" placeholder="Description">
            </textarea>
            <div class="text-center"><button type="submit" name="Insert" class="btn btn-primary" style="width:100%;">Add FAQ </button></div>
         </div>
      </form>
      <div class="col-md-4">
      </div>
   </div>
   <!-- / row -->
</div>
<?php } ?>
<!-- / container-fluid -->
<script>
      CKEDITOR.replace(ckeditor1)  
      CKEDITOR.replace(ckeditor2)
      CKEDITOR.replace(ckeditor3)
      CKEDITOR.replace(ckeditor4)
      CKEDITOR.replace(ckeditor5)
      CKEDITOR.replace(ckeditor6)
      CKEDITOR.replace(ckeditor7)
      CKEDITOR.replace(ckeditor8)
      CKEDITOR.replace(ckeditor9)
      CKEDITOR.replace(ckeditor10)
      CKEDITOR.replace(ckeditor11)
      CKEDITOR.replace(ckeditor12)    
      CKEDITOR.replace(ckeditor13)
      CKEDITOR.replace(ckeditor14)
      CKEDITOR.replace(ckeditor15)
      CKEDITOR.replace(ckeditor16)
      CKEDITOR.replace(ckeditor17)
      CKEDITOR.replace(ckeditor18)
      CKEDITOR.replace(ckeditor19)
      CKEDITOR.replace(ckeditor20)
      CKEDITOR.replace(ckeditor21)
      CKEDITOR.replace(ckeditor22)
      CKEDITOR.replace(ckeditor23)
      CKEDITOR.replace(ckeditor24)
      CKEDITOR.replace(ckeditor25)
      CKEDITOR.replace(ckeditor26)
      CKEDITOR.replace(ckeditor27)
      CKEDITOR.replace(ckeditor28)
      CKEDITOR.replace(ckeditor29)
      CKEDITOR.replace(ckeditor30)
      CKEDITOR.replace(ckeditor31)
      CKEDITOR.replace(ckeditor32)
      CKEDITOR.replace(ckeditor33)
      CKEDITOR.replace(ckeditor34)
      CKEDITOR.replace(ckeditor35)
      CKEDITOR.replace(ckeditor36)
      CKEDITOR.replace(ckeditor37)
      CKEDITOR.replace(ckeditor38)
      CKEDITOR.replace(ckeditor39)
      CKEDITOR.replace(ckeditor40)
      CKEDITOR.replace(ckeditor41)
      CKEDITOR.replace(ckeditor42)
      CKEDITOR.replace(ckeditor43)
      CKEDITOR.replace(ckeditor44)
      CKEDITOR.replace(ckeditor45)
      CKEDITOR.replace(ckeditor46)
      CKEDITOR.replace(ckeditor47)
      CKEDITOR.replace(ckeditor48)
    </script>
<?php include('site-footer.php'); ?>