Column Sort Question

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

 



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux