[FX.php List] RE: looking for advice...

John Moed john at technames.com
Tue Jan 16 09:09:32 MST 2007


Alex,

Create a variable for sort parameter and sort field. You can either create
hyper-links on the column headers that allow the user to click on them and
change the sort order. I also create a sort type variable which tells the
page what type of sort it is and a sort changed variable. If the user clicks
on the "Recipe Name" column header, the sort parameter is set to "ascend",
the sort field is set to "recipe", sort changed is set to "YES" and sort
type is set to "recipeascend". Before your find request in the PHP, put an
if...then...else statement 
Something like (off the top of my head):
If ($_get(changesort=="YES")){
$sorttype=$_get('sorttype');
$sortfield=$_get('sortfield');
$sortparam=$_get('sortparam');
}else{}

For each column header, have an if then else statement:
<?php If ($sorttype='recipeascend'){ ?>
<a
href=recipe.php?sorttype=recipedescend&sortfield=recipe&sortparam=descend&ch
angesort=YES>Recipe</a>
<?php }?>
<?php Else if ($sorttype='recipedescend'){ ?>
<a
href=recipe.php?sorttype=recipeascend&sortfield=recipe&sortparam=ascend&chan
gesort=YES>Recipe</a>
<?php Else }{ ?>
<a
href=recipe.php?sorttype=recipeascend&sortfield=recipe&sortparam=ascend&chan
gesort=YES>Recipe</a>
<?php }?>

There is probably a better way to do this, but it is working so far for me.
I would be happy to hear suggestions.

Thanks,
John



More information about the FX.php_List mailing list