Next & previous button on a dynamic page

Hi, I’m looking for a code that allows the next and previous button on a dynamic page to show FILTERED DATA (by user input on an index page) from a database.
Currently I’m using the code from corvid tutorial here >> https://support.wix.com/en/article/corvid-tutorial-creating-previous-and-next-buttons-for-a-dynamic-item-page-with-code?fbclid=IwAR1tK1zozsc2bfSQ24WS_H34vjYVGopkBd0nkaIAaE5pMUKuYQLLVTpLqtk
That is showing the data in a way I chose to sort it but not showing the changes that user is making on an index page.
For example:
I gave the user an option to choose from a dropdown dresses or trousers. He chose trousers, on an index page it is now displaying only trousers, he clicks on one and gets to a dynamic page but when clicking on a next button he gets a dress because both dresses and trousers are in the database “clothes”

Hoping for some help here
tnx

Tried the following as well and it doesn’t work, it is also showing all the items from a collection