Matic Posted August 24, 2013 Share Posted August 24, 2013 Lets say I have a form in form.php and when I click submit all inputted data is sent to model.php for database manipulation etc.. and then when everything is done the model.php redirects user back to form.php using function: header('Location:form.php'); How in the blazing hell can form.php recognize I was redirected there from model.php ? I am so lost about this for so long now, I tried $_SERVER['HTTP_REFERER'] and everything and I just get an echo with my current page location. I want to get an echo of the model.php on my form.php Quote Link to comment https://forums.phpfreaks.com/topic/281525-how-to-recognize-original-redirection-document/ Share on other sites More sharing options...
PaulRyan Posted August 24, 2013 Share Posted August 24, 2013 You could set a session variable on model.php, something like $_SESSION['model_redirect'] = true; Then on the form.php page, check to see if the session variable is set. If it is, then it was redirected from model.php, else it wasn't. Quote Link to comment https://forums.phpfreaks.com/topic/281525-how-to-recognize-original-redirection-document/#findComment-1446592 Share on other sites More sharing options...
kicken Posted August 25, 2013 Share Posted August 25, 2013 Or, just tack on a GET variable. header('Location: form.php?redir=1'); Then check for $_GET['redir'] in form.php Quote Link to comment https://forums.phpfreaks.com/topic/281525-how-to-recognize-original-redirection-document/#findComment-1446630 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.