Looking at the results.php it looks like you have a misspelling on this line:
<?php echo $_SESSION['ProductCateogryID'] = $_GET['ProductCategoryID']; ?>
You can remove that line since we don't need to use it on the results page, then update the following line:
<a class="ps_buttons" href="../../../products_detail.php?ProductID=<?php echo(rawurlencode($ProductID)); ?>">Learn more</a>
to
<a class="ps_buttons" href="../../../products_detail.php?ProductCategoryID=<?php echo $_GET['ProductCategoryID']; ?>&ProductID=<?php echo(rawurlencode($ProductID)); ?>">Learn more</a>
I'm not sure if you are using the results page in the catalog folder or in the basic folder depending on the theme you are using, but you should make the changes in both files.
On the Details.php page, you will need to update:
<a href="../../../products_results.php" class="ps_buttons">Back to Product Catalog</a>
to
<a href="../../../products_results.php?ProductCategoryID=<?php echo $_GET['ProductCategoryID']; ?>" class="ps_buttons">Back to Product Catalog</a>
This should always ensure the category id is passed around to the results and detail page.