Post the source code so we can see how you coded the pages. The sorting thing is easy enough. Change the results.page to use GET instead of POST. Add an optional query to the URL called something like sortby=xxxxx.
Then get the value of sortby using $_GET['sortby'];
Then use a switch statement to alter the msql query.
I won't post the exact code. Instead I'll let you work it out for yourself