hitman47 Posted October 15, 2013 Share Posted October 15, 2013 (edited) HALLO, i have one major problem. I have a page that submits data to another with post for example this: <form id="form2" method="post" action="articles.php" > <table id="table1" class="adminformat" > <tr><td> <br></br><td></tr> <tr > <td><strong>Category:</strong></td> <td class="spaceUnder"><select name="catid" > <?php $cat_array = get_categories(); foreach ($cat_array as $row) { echo '<option value="'. $row['catid'].'">' . $row['catname'].'</option>'; } ?> </select> </td></tr> <tr> <td colspan="2"><strong>Title :</strong> </td></tr> <tr> <td colspan="2" class="spaceUnder"><input maxlength="300" class="inputglow" type="text" name="title"/></td></tr> <tr> <td colspan="2"><strong>Message :</strong> </td></tr> <tr> <td colspan="2"><textarea name="message"> </textarea></td></tr> <td align="right" colspan="2"> <input type="reset" class="button" value="Clear"/> <input type="submit" class="button" value="OK"/></td></tr> </table> </form> The data is send to articles.php. If user presses refresh or back button, an ERROR PAGE in the browser is shown or forms are empty. I know i have to store somehow my variables. I have many forms, so i am looking for the best an easyest way, because i have to fill in a lot of code in many pages. Furthermore when i press back and forawrd again, the articles page cannot be shown. Instead teh browser shows a message that the page HAS EXPIRED! I am so freaked out. Please help i am so stuch.URGENT!!!!!!!!! Edited October 15, 2013 by hitman47 Quote Link to comment https://forums.phpfreaks.com/topic/282978-pressing-back-or-refresh-button-without-losing-form-data-urgent/ Share on other sites More sharing options...
Ch0cu3r Posted October 15, 2013 Share Posted October 15, 2013 You should not rely on the browsers back button to allow users to re-edit forms. You should provide a way for the user to go back and edit the forms so they are pre populated with the data they entered, or if you want the user to go back a page, then provide a link/button to that page or you could redirect the user with header() for an automatic redirect. If you need to clear a form you should use the forms reset button, not the browsers refresh button. Quote Link to comment https://forums.phpfreaks.com/topic/282978-pressing-back-or-refresh-button-without-losing-form-data-urgent/#findComment-1453965 Share on other sites More sharing options...
hitman47 Posted October 15, 2013 Author Share Posted October 15, 2013 You haven't understand. I don't want them to reenter forms. After submit, If the user accidentaly presses mouse or browser back button, the forms are aempty. Then if he presses forward then there is a message that THE PAGE HAS EXPIRED! I can't see the page. It's a huge bug and very annoying!!! Quote Link to comment https://forums.phpfreaks.com/topic/282978-pressing-back-or-refresh-button-without-losing-form-data-urgent/#findComment-1453967 Share on other sites More sharing options...
Ch0cu3r Posted October 15, 2013 Share Posted October 15, 2013 Maybe the following article may help http://shiflett.org/articles/how-to-avoid-page-has-expired-warnings Quote Link to comment https://forums.phpfreaks.com/topic/282978-pressing-back-or-refresh-button-without-losing-form-data-urgent/#findComment-1453969 Share on other sites More sharing options...
Solution hitman47 Posted October 16, 2013 Author Solution Share Posted October 16, 2013 No i still have problem. how to use Post/Redirect/Get http://en.wikipedia.org/wiki/Post/Redirect/Get#cite_note-1 ? Does anyone knows. I want fully detailed instractcions Quote Link to comment https://forums.phpfreaks.com/topic/282978-pressing-back-or-refresh-button-without-losing-form-data-urgent/#findComment-1454092 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.