简体   繁体   English

使用Codeigniter和POST数据重新提交表单

[英]Form Re-Submission using Codeigniter with POST data

Hi all I have a CI controller which does things such as: 大家好,我有一个CI控制器,它可以执行以下操作:

$this->loadEditingView($this->input->post('cleaned_post_data'));

which leaves the URL at the method that ran the above line such as: 将网址留在执行上述代码的方法中,例如:

mysite.com/project/main/editclasses

the problem I am having is that the I post alot of data and reload the view - meaning if the page is refreshed the form is re-submitted. 我遇到的问题是我发布了大量数据并重新加载了视图-这意味着如果刷新页面,则会重新提交表单。 I believe I can't use a redirect as the post data will be seen in the URL? 我相信我无法使用重定向,因为发布数据会显示在URL中? what is the best way to prevent the annoying form re-submission 防止恼人的表格重新提交的最佳方法是什么

您可以将发布数据存储在会话变量中,并在使用后取消设置。

Your POST Data will not be shown on the URL when you redirect with redirect() method. 当您使用redirect()方法redirect()时,您的POST数据将不会显示在URL上。 That's not how it works, read about method here: 这不是它的工作原理,请在此处阅读有关方法的信息:

http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html http://ellislab.com/codeigniter/user-guide/helpers/url_helper.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM