I have used a cookie created by a dropdown list as demonstrated here http://www.tshirt-town.com/sale/clearance-offers.php
The process is that I create a cookie onchange from the select list and submit back to the page via javascript then check the value submitted like so
switch($_COOKIE["sortBy"]) {
case "newest":
$orderClause = "tbl_products.tstampinsert DESC, tbl_products.title";
break;
case "a-z":
$orderClause = "tbl_products.title, tbl_products.sortorder";
break;
case "z-a":
$orderClause = "tbl_products.title DESC, tbl_products.sortorder";
break;
default:
// default behaviour
$orderClause = "tbl_products.sortorder, tbl_products.title";
}
Then you need to add the resulting var into the recordset like so:
AND tbl_subcategories.slug = %s ORDER BY " . $orderClause . "", GetSQLValueString...