Dear Forum,
I've been searching for quite a while for something which comes close to my question - and freiheit's thread back in May 2010 entitled 'Sorting data asc and desc using a jump menu' came the closest.
Whilst pointing me in the right direction, I need to take it a step further. He was just sorting by 'date' with a option offering the result ASC or DESC, but I want to display a list of gallery contents, whereby the page visitor can select to view the list by price (high to low, low to high), dimension (smallest to largest & vice versa), and a couple of other field names.
To create a fixed list of items I'm currently using the follow code:
<?
$sql = "SELECT * FROM art ORDER BY id";
$recordset = mysql_query( $sql )or die(mysql_error());
while( $row=mysql_fetch_assoc($recordset)) {
print $row['image'] .'<br>'. $row['title'] .'<br>
dimension:'. $row['dimension'] .'<br>
medium:'. $row['medium'] .'<br>
price: £'. $row['price'] .'<br>
sale status:'. $row['salestatus'];
}
?>
... so the 'ORDER BY id' needs to be replaced with something that links it to a pulldown menu offering title, dimension ASC, dimension DESC, medium, price ASC and price DESC - but I haven't a clue where to begin.
Lastly, on an Amazon.com page when viewing results you can also change the order you view things according to price, category, etc - but you always then have to click a 'Go' button to activate the result. Is this always essential or can the page reload automatically after the visitor has changed the selection in the pulldown menu?
I'd be very grateful for any assistance and appreciate your time and trouble.
Thanks in advance
DM