PHP Changing order and price filters using queries -
I am working on a filter for my website and it seems that my argument is ending! I managed to organize the sequence of items based on selected radio buttons but I do not know how to integrate the value inputs (from: __ to: __)
in index.php:
$ price_range = ''; If (isset ($ _ POST ['submit']) {$ lowest_price = $ _POST ['lowest_price']; $ supreme_price = $ _POST ['highest_piece']; $ $ value_range = 'value' equals '%'. $ Like "% 'and'% '. $ Highest value." $' ";} $ Order_list = (isset ($ _ POST ['order_list']))? $ _ POST ['order_list']: '' ; $ Order_list (case "link 1": $ order_list_sql = "order" by DJC "break"; case "link2": $ order_list_sql = "value" ASC "from command; breakdown;" link 3 " : $ Order_list_sql = "Order" order by "DESc"; breakdown; case "link4": $ order_list_sql = "order` id`dess"; break; default : $ Order_list_sql = "Order date from 'DJC'; $ Res = mysql_query (" Choose * FROM `classifieds`" $ order_list_sql. "LIMIT 10"); In form.php
form action = "index.php" method = "post" encrypt = "multipart / form-data"> ad orders & lt ; Ul> Labels & gt; & lt; input type = "radio" name = "order_list" value = "link1" & lt ;? Php echo (isset ($ _ POST ['order_list']) == 'link1'? 'Checked': '')? & Gt; & Gt; The newest first & lt; / Labels & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Label & gt; & Lt; Input type = "radio" name = "order-list" value = "link 2" & lt ;? Php echo (isset ($ _ POST ['order_list']) == 'link2'? 'Checked': '')? & Gt; & Gt; Lowest price first & lt; / Labels & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Label & gt; & Lt; Input type = "radio" name = "sequencing" value = "link3" & lt ;? Php echo (isset ($ _ POST ['order_list']) == 'link3'? 'Checked': '')? & Gt; & Gt; Highest value first & lt; / Labels & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Label & gt; & Lt; Input type = "radio" name = "sequencing" value = "link 4" & lt ;? Php echo (isset ($ _ POST ['order_list']) == 'link4'? 'Checked': '')? & Gt; & Gt; The closest first & lt; / Labels & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; Li & gt; Price & lt; Ul & gt; & Lt; Li & gt; From: $ & lt; Input type = "text" placeholder = "0.00" size = "8" name = "minimum_pris" value = "& lt ;? php if (isset ($ _ POST ['lowest_price'])) {echo $ _POST ['minimum_pres '];}? & Gt; "& gt; & Lt; / Li & gt; & Lt; Li & gt; To: $ & lt; Input type = "text" size = "8" name = "high_pres" value = " Upgrade: which I have tried so far, but the second statement seems to be correct if (isset $ _POST ['submit']) === Right & amp; Empty ($ _ POST ['submit'] === Incorrect) {$ lowest_price = $ _POST ['lowest_price']; $ supreme_pris = $ _POST ['highest_piece ']; $ Value_range = "where` value' is between. $ Min_price. "And". $ Highest value ""; if (empty ($ _ POST ['order_list']) === false & amp; ; $ _POST ['order_list'] == "link 1") {$ order_list = "Order Date 'DASC');} If (empty ($ _ POST ['order_list']) === False & amp; $ _POS T ['order_list'] == "link 2") {$ order_list = "value by 'value' ASC";} if (empty ($ _ POST ['order_list']) === false & amp; $ _POST [ 'Order_list'] == "link 3") {$ order_list = "order by order" deass "; } If (empty ($ _ POST ['order_list']) === false & amp; $ _POST ['order_list'] == "link 4") {$ order_list = "id by order" dess "; } $ Res = mysql_query ("Select * FROM` classifieds`" $ price_range. "" $ Order_list. "LIMIT 10"); } And order by {$ res = mysql_query ("selection '` classified` command `` DASC limit 10 "); } Change the $ price_range to:
$ Value_range = "as far as price". $ Min_private "And". $ Highest Price ""; Change to $ res
$ res = mysql_query ("select * classified". $ Price_range. "" $ Order_list_sql. "LIMIT 10" ); I know the result ..
Comments
Post a Comment