【问题标题】:Cakephp none add action formsCakephp none 添加动作表单
【发布时间】:2013-09-18 16:28:48
【问题描述】:

我的一个控制器中有一个索引操作。

在此索引操作中,我希望创建一个“搜索”表单,该表单通过发布请求调用我的控制器中的另一个操作。

我在 cakephp 中找到的所有关于表单创建的文档都是关于创建新元素(即将数据插入数据库)而不是实际将数据发送到另一个动作/函数。

这是一个例子:

    <?php echo $this->Form->create('Product'); ?>
<fieldset>
    <legend><?php echo __('Søg Produkt'); ?></legend>
    <?php
    echo $this->Form->input('Search field');
    ?>
</fieldset>
<?php echo $this->Form->end(__('Søg')); ?>

我如何将search field 的值发送到另一个操作? (因此它重定向到该操作并向其发送数据)

【问题讨论】:

    标签: php cakephp


    【解决方案1】:

    你试过read the documentation吗?

    $this->Form->create('Product', array('url' => array('action' => 'search');
    

    【讨论】:

    • 谢谢伙计,我一定在文档中错过了它
    猜你喜欢
    • 2014-05-21
    • 1970-01-01
    • 1970-01-01
    • 2020-12-15
    • 1970-01-01
    • 1970-01-01
    • 2012-05-31
    • 2013-06-11
    • 2011-04-19
    相关资源
    最近更新 更多