product display page needs query filtered for brand name and men/women/youth. A navigationbar sends the necessary variables (g,s,br) to mygear.php. There is always variable g, but sometimes s and sometimes br. Also, the product titles (queried column) doesn't contain the word 'men'. I have most of the if/else statements written - which may help.
The script you've attached does contain a few issues, but all in all, provided the database has the necessary information about the products, filtering the query should be no problem at all. PM me if you're interested in my offer.