<?php
if ($_GET['select'] == 'a1') { $order = "&orderby=views&order=DESC"; $s1 = ' selected="selected"'; }
if ($_GET['select'] == 'a2') { $order = "&orderby=date&order=DESC"; $s2 = ' selected="selected"'; }
?>
<form method="get" id="order">
<select name="select" onchange='this.form.submit()' class="sort">
<option value="a1"<?=$s1?>>По популярности</option>
<option value="a2"<?=$s2?>>По дате</option>
</select>
</form>
<?php global $query_string;
query_posts($query_string.'&'.$order);
?>
?select=a1
$query=[];
parse_str(parse_url($query_string, PHP_URL_QUERY),$query_array);
unset($query_array['select']);
echo (!empty($query_array)?'?':'').http_build_query($query_array);