title: How to pass data from view to controller in cakephp?
body: <p>I have a view like that:
  <img src="https://i.stack.imgur.com/mJKbW.png" alt="enter image description here"></p>
  
  <p>What I want is when I click on the button, it will execute a select query:</p>
  
  <pre><code>SELECT discounts.product_id, products.product_name,
  sum(products.product_price - discounts.product_discount) as total_Amount,
  count(orders.order_id) as total_Number
  FROM products 
  inner join discounts on products.product_id = discounts.product_id
  inner join orders on discounts.discount_id = orders.discount_id
  
  where discounts.start_time &gt;= **FromTextBox** and discounts.end_time &lt;= **ToTextBox**
  
  group by discounts.product_id,products.product_name
  </code></pre>
  
  <p>FromTextBox and ToTextBox are values from 2 textboxes.</p>
  
  <p>This is in my controller:</p>
  
  <pre><code>....
  $option['fields']= array('Discount.product_id','Product.product_name','benefit','number');
      //$option['conditions']=array('Discount.start_time &gt;'=&gt;array(''));  //where I put values from view
      $option['group'] = array('Discount.product_id','Product.product_name');
      $products = $this-&gt;Order-&gt;find('all',$option);
      $this-&gt;set('products',$products);
  </code></pre>
  
  <p>And my view:</p>
  
  <pre><code>&lt;label class="control-label"&gt;From&lt;/label&gt;
  &lt;div class="controls input-append date" id="dp1" data-date="" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd"&gt;
                  &lt;input size="16" type="text" value="" readonly&gt;   &lt;-- where I put textbox
                  &lt;span class="add-on"&gt;&lt;i class="icon-remove"&gt;&lt;/i&gt;&lt;/span&gt;
                  &lt;span class="add-on"&gt;&lt;i class="icon-th"&gt;&lt;/i&gt;&lt;/span&gt;
  &lt;/div&gt;
  &lt;label class="control-label"&gt;To&lt;/label&gt;
  &lt;div class="controls input-append date" id="dp2" data-date="" data-date-format="dd MM yyyy" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd"&gt;
                  &lt;input size="16" type="text" value="" readonly&gt;   &lt;-- where I put textbox
                  &lt;span class="add-on"&gt;&lt;i class="icon-remove"&gt;&lt;/i&gt;&lt;/span&gt;
                  &lt;span class="add-on"&gt;&lt;i class="icon-th"&gt;&lt;/i&gt;&lt;/span&gt;
  &lt;/div&gt;
   &lt;div&gt;
      &lt;?php echo $this-&gt;Form-&gt;button('A Button'); ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Two textboxes are used Bootstrap datepicker.
  Please help me! thanks in advance.</p>