Re: Column Sort Question
| From: | Dan Brunner | Date: | Tue, 15 Apr 2003 18:15:45 +0000 |
| Subject: | Re: Column Sort Question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27108@lists.php.net to get a copy of this message | ||
Hello!!
Is the refresh built in or do you mean when someone clicks the refresh button on thier browser???
If it's built in...using header()....You could pass the values of $sort_order and $order_by just by adding at the end of the url that is refreshed...
Or something like that...since your using Sessions...
Dan
On Tuesday, April 15, 2003, at 01:03 PM, jpweb63@hotmail.com wrote:
Hi All, I am a newbie at this stuff so I hope this makes sense. I want clickable column headings in a table that sort on click. I got it working using the code below but can't figure out how to get past the issue of the refresh button. I only want it sort when a column is clicked. Ever time Refresh is hit it toggles my sort routine. I understand why it's doing it in my code but I can't figure out how to code around the Refresh. Thank, Jerry $default_sort_order = 'asc'; $default_order_by = "Application"; $order_by = $_GET['order_by']; if (empty($order_by)) { $order_by = $default_order_by; } $sort_order=$_SESSION['sort_order']; if (empty ($sort_order)) { $sort_order = $default_sort_order; $_SESSION['sort_order'] = $sort_order; }else{ if (($_SESSION['sort_order'] == 'asc') && ($_SESSION['last_infield'] == $order_by)) { $sort_order = 'desc'; $_SESSION['sort_order'] = 'desc'; }else{ $sort_order = 'asc'; $_SESSION['sort_order'] = 'asc'; } } $_SESSION['last_infield'] = $order_by; -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php