<?php

//query for fetching blo categories
$sql_cat = "select category_id, category from tbl_category where category_for = 'ACT' and status = 'ACTIVE' and deleted = 0 ";
$sql_cat = $sql_cat . " order by category ";
//echo "sql_cat=".$sql_cat;
$result_cat = mysqli_query($dbh->link, $sql_cat);

if ($result_cat) {
  $no_of_cat = mysqli_num_rows($result_cat);
}
?>
<div class="col-lg-4 mt-5 mt-lg-0">
  <aside class="sidebar p-4 shadow-sm rounded-4">
    <!-- Search -->
    <form method="post" name="frmBlogs" id="frmBlogs" class="mb-4">
      <div class="input-group">
        <input type="text" class="form-control" name="txtBlogs" placeholder="Search blog..." value="<?php echo $blogs; ?>">
        <button class="btn" onClick="SearchBlogs()">Search</button>
        <input name="txtAction" id="txtAction" type="hidden">
      </div>
    </form>

    <!-- Recent Posts -->
    <div class="recent-posts">
      <h5 class="recent-title mb-3">Recent Posts</h5>
      <ul class="list-unstyled">
        <?php for ($i = 0; $i < $no_of_blogs2; $i++) {
          $blog_title_org2[$i] = $blog_title2[$i];
          $slug2 = strtolower(preg_replace('/[^A-Za-z0-9-]+/', '-', $blog_title2[$i]));
          $url2 = "{$blog_id2[$i]}-$slug2-blog.php";
        ?>
          <li class="recent-link mb-2">
            <a href="<?php echo $url2; ?>"><?php echo $blog_title_org2[$i]; ?></a>
          </li>
        <?php } ?>
      </ul>
    </div>
  </aside>
</div>