<select name="filtering">
<option value="a">a</option>
<option value="b">b</option>
if (isset($_POST['filtering']) == "a") {
$stmt = prepare("SELECT * FROM user_posts ORDER BY post_time DESC LIMIT :limit OFFSET :offset");
}
if (isset($_POST['filtering']) == "b") {
$stmt = prepare("SELECT * FROM user_posts ORDER BY post_time ASC LIMIT :limit OFFSET :offset");
}
Isset вернет только true или false
if (isset($_POST['filtering'])&&($_POST['filtering']=="a")){
$stmt = prepare("SELECT * FROM user_posts ORDER BY post_time DESC LIMIT :limit OFFSET :offset");
}
if (isset($_POST['filtering'])&&($_POST['filtering']=="b")) {
$stmt = prepare("SELECT * FROM user_posts ORDER BY post_time ASC LIMIT :limit OFFSET :offset");
}
Других решений пока нет …