$_POST Variable Detected in Chrome but not in Firefox

Posted by user1707973 on Stack Overflow See other posts from Stack Overflow or by user1707973
Published on 2012-09-29T07:53:58Z Indexed on 2012/09/29 9:37 UTC
Read the original article Hit count: 155

Filed under:
|
|
|

I am using 2 images in a form to sort out query results from the database. The form is submitted using the POST method. When i click on the first image, the query results have to be sorted in ascending order, and when i click on the second, the results have to be sorted in the descending order. This is the code for the form:

 <form name="" action="" method="post">
   <input type="hidden" name="typep" value="price" />
   <input type="image"  name="sort"  value="asc"  src="images/asc-ar.png" />
   <input type="image"  name="sort"  value="desc" src="images/dsc-ar.png" />
 </form>

Now this is the code for checking if the $_REQUEST['sort'] variable is set and therefore whether sorting is required or not.

if ($_REQUEST['sort'] != "")
{
    $sort  = $_REQUEST['sort'];
    $typep = $_REQUEST['typep'];
   //query to be executed depending on values of $sort and $typep
}

Firefox does detect the $_REQUEST['typep'] variable but not the $_REQUEST['sort'] one. This works perfectly in Chrome though. When i test the site in Firefox, it doesn't detect the $_REQUEST['sort'] variable and therefore the if condition evaluates to false and the search results don't get sorted.

© Stack Overflow or respective owner

Related posts about php

Related posts about html