Forum Moderators: coopster
I have a multiple selects:
<select name="sort[]"><option value="">None</option><option value="id">ID</option>...
<?php
$order = implode(", ", $_POST["sort"]);
$sql = "SELECT * FROM table ORDER BY ".$order;
$_POST["sort"] = array_diff($_POST["sort"], array("")); ;)
Dcrombie: According to a simple test with array_filter($array) and array_diff($array, array('')) is array_filter 2.5 times faster than array_diff when deleting empty entries. ( [php.net...] )
Thanks all!
Michal Cibor