PHP Application guarantee no re-post

ApartamentyReg

New Member
I might not have known what to search for to get this answer so please point me to the correct post if this has been dealt with already. Now then, I have a little custom CMS and I want to ensure users don't re-submit their $_POST data by refreshing the page. So I've done something like this:\[code\]<? //Start a session to hold variables I want after my redirect session_start(); if($_POST){ //Do some php stuff and if I'm happy with the results... $_SESSION['some_vars'] = $whatever; //Bring me back here but without the $_POST data header('Location: '.THIS_PAGE); exit; }?>\[/code\]When the script reloads I use my session variables and trash the session.I'm wondering if anybody has a better way to handle this. It's fairly non cumbersome but I'm always looking for more efficiency. Thanks. EDIT: By the way, stackoverflow.com does this somehow when you post a question if what I'm doing seems unclear, but they also make a permalink while they're at it.
 
Back
Top