I have a form that has a multiple select choice, like this:
<form method="post" action="display.php"
<select multiple name="selectsort[]">
<option value="code">Code</option>
<option value="amount">Amount</option>
<option value="dateammended">Date Ammended</option>
<option value="expreviewdate">Expiration/Review Date</option>
<option value="effectivedate">Effective Date</option>
<option value="expired">Expired</option>
<option value="team">Issuing Team</option>
<option value="originate">OSL Originate</option>
</select>
</form>
The display.php file runs a query that sorts the results based on the selection (sometimes multiple) made in the form. The display.php file looks something like this:
$selectsort = $_POST['selectsort'];
if( isset( $POST['selectsort'] )) {
$query = "SELECT * FROM contracts ORDER BY '{$POST['selectsort']}' DESC";
}
$result = mysql_query($query);
I then echo the information in a table. I get results, but it doesn't pay attention to multiple selections. It only orders by the last selection made.
I can echo out the various selections and can see that the select part is working.
echo "$selectsort[0] , $selectsort[1] , $selectsort[2], ........"
How can use the selectsort[] array to order by the multiple selections?