Re: Dynamic HTML table sort with PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Ken,

Friday, July 7, 2006, 10:26:57 AM, you wrote:
> If I have a table header that contains a link that when clicked
> resubmits the page to itself with the proper sort query variables
> (e.g. index.php?sortBy=ORDER_ID&sortOrder=ASC), I want PHP to
> rewrite the sortOrder query string to be "sortOrder=DESC" and then
> "sortOrder=ASC" the next time column heading is clicked. This way,
> the column will sort like windows columns and users will feel
> "at-home" with the process.

Check the query_string on submission and change the GET link on the
column header to the opposite value.

i.e.

echo '<a href="index.php?sortBy=ORDER_ID&sortOrder=';
echo $_GET['sortOrder'] == 'ASC' ? 'DESC">' : 'ASC">';
echo 'ORDER ID</a>';

This will flip your link between ASC and DESC when clicked. Tested and
working.


-- 
                          TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x5D167202
 __    ____  ____  ____   Geocaching:                    http://gps.PCWize.com
(  )  ( ___)(_  _)( ___)  TBUDP Wiki Site:  http://www.PCWize.com/thebat/tbudp
 )(__  )__)  _)(_  )__)   Roguemoticons & Smileys:    http://PCWize.com/thebat
(____)(____)(____)(__)    PHP Tutorials and snippets:    http://www.DevTek.org

What would happen if an unstoppable object collided with an unmovable one???

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux