将cakephp POST参数插入URL [英] Insert cakephp POST params into URL
本文介绍了将cakephp POST参数插入URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下表单,其中包含两个复选框,用于对一些产品进行排序:
< form id =FiltreExtraFormaction =method =postname =FiltreExtraForm>
< input id =ProductsDeliveryPricetype =checkboxvalue =1name =data [Products] [delivery_price]/>
< input id =ProductsPicturetype =checkboxvalue =1name =data [Products] [picture]/>
< / form> POST之后,我进行过滤,但我也想添加接收的参数到URL Eg:/ products / index / delivery_price:1 / picture:0。这可能吗。
注意:我不想使用GET发送表单信息。
解决方案听起来你想要做一个帖子/重定向/获取。
以下是在CakePHP中执行此操作的两个示例:
将 POST
重定向到 GET
请求的两个主要优点是:
- 用户没有收到您要重新提交吗?
- 生成的页面/查询可以添加书签
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>
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?
Note: I don't want to use GET to send form info.
解决方案 Sounds like you are looking to do a Post/Redirect/Get.
Here are two examples of doing this in CakePHP:
The two main advantages of redirecting a POST
to a GET
request are:
- Users don't get the "Do you want to resubmit?" dialog if they refresh
- The resulting page/query can be bookmarked
这篇关于将cakephp POST参数插入URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文