PHP li值用于sql查询

I'd like to use the dynamic value of my li tag in an sql query. I added an id to it, but I guess my code is wrong. I'm new here so help me please, thank you.

Here is my code for my li tag:

<?php
      $catque = "SELECT * FROM category_tb WHERE account_id_fk={$_SESSION['account_id']}";
      $catresult = mysqli_query($connect,$catque);
      $catid="";
      ?>
      <ul name="catnav" id="catbarr">
        <li class="lii aactive" onclick="filterSelection('all')">All Products</li>
        <?php

    while($row = mysqli_fetch_array($catresult))   
    { 
    ?>
       <!--  <li><button class="btn" onclick="filterSelection('category')"> <?php echo $row["category_name"]; ?> </button></li>
       -->
      <li class="catname lii" id="catid" onclick="filterSelection('category')"> <?php echo $row["category_name"]; ?> </li>

    <?php
    }
    ?>
    </ul>

Here is my code for my sql query where I want to use the li id:

<div class="tab-content products filterDiv category">
                 <?php
                    $catquer = "SELECT * FROM product_tb WHERE (category_id_fk  IN (SELECT category_id FROM category_tb WHERE category_name = 'catid' ) AND account_id_fk = {$_SESSION['account_id']}) ORDER BY product_id ASC";
                    $queresult = mysqli_query($connect,$catquer);  
                    while($row = mysqli_fetch_array($queresult))
                    {
                    ?>  
                      <div class="col-md-4" style="margin-top:12px;">  

                      <div style="border:1px solid #333; background-color:#f1f1f1; border-radius:5px; padding:16px; height:350px;" align="center">  
                           <div class='imgborder'>
                           <img src="images-products/<?php echo $row["product_image"]; ?>" class="img-responsive"/><br />  
                           </div>
                           <h4 class="text-info"><?php echo $row["product_name"]; ?></h4>  
                           <h4 class="text-danger">₱ <?php echo $row["price"]; ?></h4>  
                           <input type="number" name="quantity" id="quantity<?php echo $row["product_id"]; ?>" class="form-control" value="1" min="1" max="100" />  
                           <input type="hidden" name="hidden_name" id="name<?php echo $row["product_id"]; ?>" value="<?php echo $row["product_name"]; ?>" />  
                           <input type="hidden" name="hidden_price" id="price<?php echo $row["product_id"]; ?>" value="<?php echo $row["price"]; ?>" />  
                           <input type="button" name="add_to_cart" id="<?php echo $row["product_id"]; ?>" style="margin-top:5px;" class="btn btn-warning form-control add_to_cart btnStyle" value="Add to Cart" />  
                      </div>  
                 </div>

OK. As far as I understood, you are trying to use some value from HTML li tag in your SQL, and you said it is dynamic.

  1. If you want to use li tag value in server side, just keep your li tag value in an variable and later use it anywhere.

  2. If you are trying to get it from client side, you need to use Javascript to get value from any specific li. Then you can send AJAX request.

It might be better to answer if you can specify exactly what problem you are facing. It is hard to go throw line by line searching for unknown errors.