<?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
if(isset($_GET['del']))
    {
       $id = mysqli_real_escape_string($link,$_GET['del']);
      if(mysqli_query($link,"DELETE FROM `tbl_contact` WHERE `id`=$id"))
        {
          $msg= "<p style='color:green;'>Delete News Letter!!!!</p>";
        }
    }   
?>
    <section id="page-title" class="row">
      <div class="col-md-8">
        <h1>Show Contact</h1>
        <p class="lead">Update your Contact</strong>.</p>
        <?=$msg?>
      </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>
        <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 Contact</h3>
            </header>
            
            <table class="table table-hover table-responsive" width="100%">
              <thead>
                  <tr>
                    <th scope="row" style="color:black;">S. No</th>
                    <th style="color:black;">Pages Name </th>
                    <th style="color:black;">Name :</th>
                    <th style="color:black;">Email Id</th>
                    <th style="color:black;">Phone</th> 
                    <!-- <th style="color:black;">Subject</th> -->
                    <th style="color:black;">Message</th>
                    <th style="color:black;">Date</th>
                    <th style="color:black;">Action</th>
                  </tr>  
              </thead>
              <tbody>
                <?php
                $sn=0;
                $ReadSql = "SELECT * FROM `tbl_contact` ORDER BY `id` DESC";
                $sel = mysqli_query($link,$ReadSql);
                while($arr = mysqli_fetch_assoc($sel))
                  {
                    $sn++;
                  ?>
                    <tr>
                      <td><?=$sn?></td>
                      <td style="color: green"><?=$arr['type']?></td>
                      <td><?=$arr['name']?></td>
                      <td>
                        <a href="mailto:<?=$arr['email']?>">
                          <?=$arr['email']?>
                        </a>
                      </td>
                       <td><?=$arr['phone_number']?></td> 
                      <!-- <td>
                        <p class="hghtscrol">
                              <?=$arr['msg_subject']?>    
                        </p>
                      </td> -->
                      <td><p class="hghtscrol"><?=$arr['message']?></p></td>
                      <td>
                          <?=$arr['date']?>
                      </td>
                      <td><a class="btn btn-danger" href="?del=<?=$arr['id']?>">Delete</a></td>
                    </tr>
                  <?php
                  }
                  ?>
              </tbody>
            </table>
          </section>
        </div>
      </div>
    </div>
    <!-- / container-fluid -->
 <?php include('site-footer.php'); ?>


<style>
  .hghtscrol
  {
    height:60px !important;
    overflow-y: scroll;
  }
</style>