php - Form stops to pass data after user has logged in -
i want sort items on page , using form:
<form method="get" action=""> <label for="sort">sort items by</label> <select id="sort" name="sort"> <option value="">-</option> <option value="plth">price (low high)</option> <option value="phtl">price (high low)</option> <option value="naz">name (a-z)</option> <option value="nza">name (z-a)</option> </select> <input type="submit" name="sortsubmit" value="go >"> </form>
after form has been processed, use sql statements retrieve items in desired order database:
if(isset($_get["sortsubmit"]) && $_get["sort"] == "plth") { $retrieve = "select * products id <= '9' order price asc"; } elseif (isset($_get["sortsubmit"]) && $_get["sort"] == "phtl") { $retrieve = "select * products id <= '9' order price desc"; } elseif (isset($_get["sortsubmit"]) && $_get["sort"] == "naz") { $retrieve = "select * products id <= '9' order name asc"; } elseif (isset($_get["sortsubmit"]) && $_get["sort"] == "nza") { $retrieve = "select * products id <= '9' order name desc"; }
the problem is, working fine until user logs in. after user has logged in, stops working , cannot figure out why. testing echo statements found out form not passing data anymore. cant imagine how has sessions or cookies. ideas.
<form method="get" action=""> <label for="sort">sort items by</label> <select id="sort" name="sort"> <option value="">-</option> <option value="plth">price (low high)</option> <option value="phtl">price (high low)</option> <option value="naz">name (a-z)</option> <option value="nza">name (z-a)</option> </select> <input type="submit" value="go"> </form>
now if page called sort.php te form submit sort.php too.
this way, in header can read values this.
$sort = $_get['sort']; switch ($sort){ case "plth": $retrieve = "select * products id <= '9' order price asc"; break; // other possible value andling here
Comments
Post a Comment