How to set the function to make user click the table header to change sorting order
<p>I want to let user click the table header to sort the table, but can just set the ascending order, can not set the descending order in the same table header. following is the function I used,  </p>

<pre><code>function sortBy(sKey)
{
   document.sortResultsForm.sSortBy.value=sKey;
   document.sortResultsForm.submit();
}

function sortDistrictNamedescend($a, $b)
{
    if ($a-&gt;DistrictName == $b-&gt;DistrictName)
    {
        return 0;
    }
    return ($a-&gt;DistrictName &lt; $b-&gt;DistrictName) ? 1 : -1;
}

function sortDistrictNameascend($a, $b)
{
    if ($a-&gt;DistrictName == $b-&gt;DistrictName)
    {
        return 0;
    }
    return ($a-&gt;DistrictName &lt; $b-&gt;DistrictName) ? -1 : 1;
}

if($sSortBy=="District")
{
   usort($tempArr, 'sortDistrictNameascend');
}
</code></pre>
