![]() |
Sort Button
How can I create a sort button that sorts DESCENDING by default but when clicked on the page changes to ASCENDING and vise versa depending the current value?
current button: PHP Code:
Thanks. |
Before page content and before your DB query.
PHP Code:
PHP Code:
PHP Code:
|
Quote:
Quote:
Slayer, your code is also going to cause parse errors..: Code:
<div class="sortbtns\"><a href='{$_SERVER['PHP_SELF']}?sortby=year'>Year</a></div>Code:
<div class=\"sortbtns\"><a href=\"{$_SERVER['PHP_SELF']}?sortby=year\">Year</a></div>PHP Code:
|
Hey Tangoforce,
This is exactly what I am looking for.. I have tested the code you put in place and it never seems to change from 'ASC' Any thoughts to it.? Thanks again. Slayer |
Quote:
Also having looked at the code, you'll need to change the sortby name of the $_GET array (and the link) to something else - sorry, didn't realise it was already in use for the year :o - infact thats probably the actual problem so try this instead: (Note that sortby is now sortdir) PHP Code:
|
Hey Tango,
I think it is the link that never changes? PHP Code:
Sorry to be a pain.. maybe I am jut not understanding. Thanks again.. Slayer. |
Because I'm a blithering idiot thats why it's not changing :p It's right in principle but just a bit mixed up :o
PHP Code:
Edit: This time I've even tested it in my own browser to be sure it works :) |
Now thats what I am talking about!!!
You are awesome .. Works like a charm. Thank you sooooo much!! Slayer. |
No worries :thumbsup:
|
| All times are GMT +1. The time now is 07:16 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.