FUNKAM35 Posted April 17, 2014 Share Posted April 17, 2014 $select = "SELECT prop_id, ref, complex, price, beds, location, type, disc, sold, updated FROM sales ".$order; echo "<table width=\"80%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"left\"><tr><td class=\"norm\" align=\"left\"><div class=\"styled-select\"><form id=\"formorder\" action=\"$_SERVER[REQUEST_URI]\" method=\"get\"><select name=\"order_by\"onChange=\"UpdateQty(this)\" ><option value=\"sort by\" selected=\"selected\">Sort by</option><option value=\"priceasc\">Lowest Price First</option><option value=\"pricedesc\">Highest Price First</option><option value=\"newest\">Recently Added</option><option value=\"updated\">Recently Updated</option><option value=\"bedsasc\">Beds (Low to High)</option><option value=\"bedsdesc\">Beds (High to Low)</option></select><input type=\"submit\" name=\"submit\" id=\"button\" value=\"go\"></form></div></td> <td class=\"norm\" align=\"left\">\n"; if($order_by=="priceasc"){ echo"Sorted by Lowest Price First"; } if($order_by=="pricedesc"){ echo"Sorted by Highest Price First"; } if($order_by=="newest"){ echo"Sorted by Recently Added Properties First"; } if($order_by=="updated"){ echo"Sorted by Recently Updated Properties First"; } if($order_by=="bedsdesc"){ echo"Sorted by Recently Added Properties First"; } if($order_by=="bedsasc"){ echo"Sorted by Recently Updated Properties First"; } echo"</tr></td></table>\n"; the following script does not display the sorted by part It works in that it changes the order but the echo Sorted by does not display instead it displays nothing, please help spent hours trying to figure it out. thanks Quote Link to comment Share on other sites More sharing options...
FUNKAM35 Posted April 17, 2014 Author Share Posted April 17, 2014 <?php if(empty($_GET['order_by']))$order="order by price ASC "; if($_GET['order_by']=='priceasc')$order="order by price ASC "; if($_GET['order_by']=='pricedesc')$order="order by price DESC "; if($_GET['order_by']=='newest')$order="order by prop_id DESC "; if($_GET['order_by']=='updated')$order="order by updated DESC "; if($_GET['order_by']=='bedsasc')$order="order by beds ASC "; if($_GET['order_by']=='bedsdesc')$order="order by beds DESC "; ?> this is at the top of the page Quote Link to comment Share on other sites More sharing options...
Solution adam_bray Posted April 17, 2014 Solution Share Posted April 17, 2014 Where are you setting $order_by ? Add this at the top - $order_by = $_GET['order_by']; Quote Link to comment Share on other sites More sharing options...
FUNKAM35 Posted April 19, 2014 Author Share Posted April 19, 2014 It worked fantastic many thanks adam! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.