Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在cakephp中将数据从视图传递到控制器?_Cakephp - Fatal编程技术网

如何在cakephp中将数据从视图传递到控制器?

如何在cakephp中将数据从视图传递到控制器?,cakephp,Cakephp,我有这样的看法: 我想要的是,当我单击按钮时,它将执行选择查询: 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.pro

我有这样的看法:

我想要的是,当我单击按钮时,它将执行选择查询:

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 >= **FromTextBox** and discounts.end_time <= **ToTextBox**

group by discounts.product_id,products.product_name
我的看法是:

<label class="control-label">From</label>
<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">
                <input size="16" type="text" value="" readonly>   <-- where I put textbox
                <span class="add-on"><i class="icon-remove"></i></span>
                <span class="add-on"><i class="icon-th"></i></span>
</div>
<label class="control-label">To</label>
<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">
                <input size="16" type="text" value="" readonly>   <-- where I put textbox
                <span class="add-on"><i class="icon-remove"></i></span>
                <span class="add-on"><i class="icon-th"></i></span>
</div>
 <div>
    <?php echo $this->Form->button('A Button'); ?>
</div>
来自
两个文本框用于引导日期选择器。
请帮帮我!提前感谢。

您应该使用“Ajax”将“datepicker”中选择的内容发送到服务器,执行查询并使用结果创建表。cakephp无法直接解决您的问题

谢谢您的回答。有没有这样的例子?我对cakephp有点陌生。我没有这方面的示例代码。有一个jquery插件“datatable”。请参阅服务器端配置和日期筛选器。我认为你的要求几乎是一样的。
<label class="control-label">From</label>
<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">
                <input size="16" type="text" value="" readonly>   <-- where I put textbox
                <span class="add-on"><i class="icon-remove"></i></span>
                <span class="add-on"><i class="icon-th"></i></span>
</div>
<label class="control-label">To</label>
<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">
                <input size="16" type="text" value="" readonly>   <-- where I put textbox
                <span class="add-on"><i class="icon-remove"></i></span>
                <span class="add-on"><i class="icon-th"></i></span>
</div>
 <div>
    <?php echo $this->Form->button('A Button'); ?>
</div>