将 cakephp POST 参数插入 URL [英] Insert cakephp POST params into URL

查看:20
本文介绍了将 cakephp POST 参数插入 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面有这个表格,其中包含两个用于对某些产品进行排序的复选框:

I have this form below which contains two checkboxes to sort some products:

<form id="FiltreExtraForm" action="" method="post" name="FiltreExtraForm">
    <input id="ProductsDeliveryPrice" type="checkbox" value="1" name="data[Products][delivery_price]"/>
    <input id="ProductsPicture" type="checkbox" value="1" name="data[Products][picture]"/>
</form>

POST 后,我进行了过滤,但我还想将接收到的参数添加到 URL,例如:/products/index/delivery_price:1/picture:0 .这可能吗.我该怎么做?

After POST I do the filtering but I also want to add received parameters to URL E.g: /products/index/delivery_price:1/picture:0 . Is this possible. How can I do that?

注意:我不想使用 GET 发送表单信息.

Note: I don't want to use GET to send form info.

推荐答案

听起来您想要做一个 发布/重定向/获取.

Sounds like you are looking to do a Post/Redirect/Get.

以下是在 CakePHP 中执行此操作的两个示例:

Here are two examples of doing this in CakePHP:

POST 重定向到 GET 请求的两个主要优点是:

The two main advantages of redirecting a POST to a GET request are:

  1. 用户不会收到您要重新提交吗?"的提示.对话框(如果刷新)
  2. 可以为结果页面/查询添加书签

这篇关于将 cakephp POST 参数插入 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆