your link code:
<a href="#"><?php echo $row_Recordset2['SubCatName']; ?></a>
you can add the link to the subcat page and pass the subcat ID in the href:
<a href="subcat.php?SubCatID=<?php echo $row_Recordset2['SubCatID']; ?>><?php echo $row_Recordset2['SubCatName']; ?></a>