vigv Posted April 7, 2011 Share Posted April 7, 2011 How do you clear GET variables after performing the action in the same page? I have tried to unset() them, but every time I refresh, the script reruns all over again and in the end, I have duplicate entries. Quote Link to comment https://forums.phpfreaks.com/topic/232980-clearing-get-variables/ Share on other sites More sharing options...
harristweed Posted April 7, 2011 Share Posted April 7, 2011 Leave page after doing whatever it is you do using something like: if(operation completed){ header("Location: send_me_back.php"); /* Redirect browser */ exit; } And have @send_me_back.php use same method to return to original page but without the $_GET Quote Link to comment https://forums.phpfreaks.com/topic/232980-clearing-get-variables/#findComment-1198219 Share on other sites More sharing options...
vigv Posted April 7, 2011 Author Share Posted April 7, 2011 Assuming the original file's called index.php, wouldn't it header("Location: index.php"); do the same thing? Quote Link to comment https://forums.phpfreaks.com/topic/232980-clearing-get-variables/#findComment-1198221 Share on other sites More sharing options...
vigv Posted April 7, 2011 Author Share Posted April 7, 2011 Yeah, it does. Thanks for the tip, really appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/232980-clearing-get-variables/#findComment-1198224 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.