Niccaman Posted October 22, 2009 Share Posted October 22, 2009 I have a variable in the URL which i wanted for one-time processing. Obviously once the page is loaded the client still has this variable and its value still in the URL, meaning, if they refresh, some code will be processed again. So what i want to do is remove this variable from the url. e.g. "./something.php?variable=true" ... how will i remove "?variable=true" using php?? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/178627-solved-removing-get-variable-from-a-url-once-processed/ Share on other sites More sharing options...
salathe Posted October 22, 2009 Share Posted October 22, 2009 Redirect them to a page without that value in the URL. Link to comment https://forums.phpfreaks.com/topic/178627-solved-removing-get-variable-from-a-url-once-processed/#findComment-942134 Share on other sites More sharing options...
mrMarcus Posted October 22, 2009 Share Posted October 22, 2009 some code will be processed againnot some code, the same code. only way i can think is to use a header() redirect upon completion of script and strip the url of any variables. Link to comment https://forums.phpfreaks.com/topic/178627-solved-removing-get-variable-from-a-url-once-processed/#findComment-942136 Share on other sites More sharing options...
Bricktop Posted October 22, 2009 Share Posted October 22, 2009 Hi Niccaman, You would have to do a page redirect once you've run your one-time process. Even unset() will not work if the user refreshes the browser. Hope this helps. Link to comment https://forums.phpfreaks.com/topic/178627-solved-removing-get-variable-from-a-url-once-processed/#findComment-942137 Share on other sites More sharing options...
Niccaman Posted October 22, 2009 Author Share Posted October 22, 2009 Ok, i guess you guys would know if anybody. Thankyou for your time guys, i really appreciate it. ...Problem is, any error messages from the one time script wont echo as i am effectively reloading the page. Any ideas? either way topic solved Link to comment https://forums.phpfreaks.com/topic/178627-solved-removing-get-variable-from-a-url-once-processed/#findComment-942152 Share on other sites More sharing options...
mrMarcus Posted October 22, 2009 Share Posted October 22, 2009 if ($errors) { //stay on page and display errors... } else { header ('Location: go/somewhere/far/far/away.php'); //redirect to success page; } Link to comment https://forums.phpfreaks.com/topic/178627-solved-removing-get-variable-from-a-url-once-processed/#findComment-942166 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.