The header for your post says you want to sort by fields while the body of the post looks like you want to restrict by certain fields. To sort by different fields just have a link at the top of each column that allows you to change the value of the order field.
Code:
<a href=aaaa.php?order_field=title>Title</a>
I'd suggest using a table rather than just echoing the values out. I'd also use a scrollable table rather than grabbing the data again. Using select * isn't good because it makes it difficult to see what's being pulled from the database and tends to cause errors if the table changes.
To restrict by certain species just add a where clause to your select statement and pass this field back via your form.
Code:
$sql = "SELECT * FROM Reports";
if ( "$species" > "" ) {
$sql .= " where species = '$species'";
}
if ( "$order_field" > "" ) {
$sql .= " order by $order_field";
}
$data = mysql_query($sql) or die(mysql_error());
PS your web link doesn't work.
Mike