title: Filter results on the basis of Checkbox value
body: <p>This is my PHP code</p>
  
  <pre><code>// category filter
      if(!isset($_POST['products']) || $_POST['products'] == ""){
          $category_filter = "";
      } else {
          $category_filter = " AND cat_id='".$_POST['products']."'";
      }
  
  // offers filter
      if($_POST['offer'] != "YES")
      {
          $offer_filter = "";
      } else {
          $offer_filter = " AND offer=1"; 
      }
  
      $sql = $db-&gt;get_rows("
          SELECT *, ( 3959 * ACOS( COS( RADIANS(".$_POST['lat'].") ) * COS( RADIANS( latitude ) ) * COS( RADIANS( longitude ) - RADIANS(".$_POST['lng'].") ) + SIN( RADIANS(".$_POST['lat'].") ) * SIN( RADIANS( latitude ) ) ) ) AS distance 
          FROM stores 
      WHERE status=1 AND approved=1 ".$offer_filter." ".$category_filter." 
      HAVING distance &lt;= ".$_POST['distance']." 
      ORDER BY distance ASC 
      LIMIT 0,60");
  </code></pre>
  
  <p>I am looking to get the correct value for <code>$offer_filter</code> in my SQL query above as is perfectly happening for <code>$category_filter</code>.
  I think I am missing out something somewhere... please if someone can help me with this...</p>
  
  <p>The following is my HTML Code in the php index file for the checkbox input...</p>
  
  <pre><code>&lt;input type="checkbox" name="offer" value="Yes" onChange="cachesearch = '';$('#clinic-finder-form').submit();"&gt; Discount Offers Available
  </code></pre>