Quick solution
When successfully submitting a form, post the form to a different location, then use the following code to perform a redirect
header("Location: url-to-end-up/");
For example post the form to _www.xxx.com/app/form_ Where “form” is the controller of app. Assuming form can be access at http://www.xxx.com/app (app’s default controller is “form”), and you want the suer to be redirected back to the form, then the code woule be
header("Location: .");
Basically you are posting the form to app/form then redirect the user back to app/
header(“Location: form/”) will redirect successfully, but it keeps the post data and will prompt a warning for resubmitting form when freshing page
Analysis
In CodeIgniter there’s a cleaner way to redirect:
redirect('url')
You can also force page refresh by adding a second parameter:
redirect('url', 'refresh')
Tt forces the web page to reload which gives the web page an extra “flash” and doubling the requests to the server.
Conclusion
Another commonly used design patter to solve this problem is usually referred as Post/Redirect/Get