Page 1 of 1

Sorting my records using the Jump menu

Posted: Wed Aug 11, 2010 12:58 pm
by adsegzy
Hello Friends,

I have a page hwere i echo out my search results from my mysql database. by defualt the echo results are sort by date desc. but i want to jump menu that will have the following;

Sort by Date in Ascendind order
Sort by Date in Descending order
Sort by IP in Ascendind order
Sort by IP in Descending order
Sort by Location

What i want to do is that if i select "Sort by IP in Ascendind order" from the jump menu, the result on the page should be sorted by IP in ascending order, or if i select "Sort by Location" the result should be sorted by Location on this same page.

Plsease how do i go about it?

Regards
adsegzy

Re: Sorting my records using the Jump menu

Posted: Wed Aug 11, 2010 1:09 pm
by Gargoyle
create a dropdown that will call the script like

Code: Select all

search.php?sort=1
and in your script, put something along the lines of this pseudocode

Code: Select all

if($sort==1)
{sort by date}
if($sort==2)
{sort by something else}