in kohana controllers that involve form manipulations, i use to declare a vire message like:
$this->view->message = __('mESSAGE HERE');
for the user to know that the form has been successfully submited.
in the form i have:
<? if(isset($message)):?>
<p class="message"><?= $message; ?></p>
<form id=.........
so after some submit the form, if it was a succes, it is displayed a message. my problem is:
if this person refreshes the page, the form is resubmited :(( can this be avoided somehow? (eventually without using redirect, but just javascript/jquery)?
thank you!
You can create a hidden field with a random string (only when POST is empty!). The same string (token) saves in session. So, after succesfully submit you need to clear session key. Also, this method helps to avoid cross-site request forgeries
Anyway, redirect is the best way to prevent the user from the confusing messages about re-sending the request data