I have this category menu. When I click on a category menu item, it opens the category page and what I need it to add the 'active' Bootstrap class on the menu item that was selected (clicked).
How can I do it?
<?php
$cat = "SELECT * FROM category WHERE cat_parent_id = :value ORDER BY cat_id ASC";
$stmt = $con->prepare($cat);
$stmt->bindValue(':value', 1, PDO::PARAM_STR);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
extract($row);
$name_cat = str_replace("-"," ", $cat_name);
$name_under = str_replace(" ","-", $cat_name);
?>
<li><a class="dropdown-item" href="<?php echo $home_url .
$cat_id."/".strtolower($name_under);?>.html"><?php echo strtoupper($name_cat); ?></a>
</li>
<?php } ?>