poleposters Posted April 17, 2008 Share Posted April 17, 2008 Hi all, After a user on my website successfully completes a form or performs some other action like uploads a photo, I'd like to redirect them to the main user panel. I can do this with Header:Location but I also want to tell the page I am redirecting to which page I have redirected from. I'd liek to do this so I can display a message on the main console like form successfully submitted or profile phot added. Is this possible? Link to comment https://forums.phpfreaks.com/topic/101552-can-i-redirect-to-a-page-and-tell-the-page-which-page-i-have-come-from/ Share on other sites More sharing options...
JSHINER Posted April 17, 2008 Share Posted April 17, 2008 You could have the header location handle it. Let's say for example on the photo upload, upon successful upload do: header('Location: mainpanel.php?photo'); Then on the mainpanel.php do: if(isset($_GET['photo'])) { echo 'You just uploaded a photo!'; } Link to comment https://forums.phpfreaks.com/topic/101552-can-i-redirect-to-a-page-and-tell-the-page-which-page-i-have-come-from/#findComment-519433 Share on other sites More sharing options...
mofm Posted April 17, 2008 Share Posted April 17, 2008 yes ofcourse this is posible but you want how right well you could do it using PHP SESSIONS and little toturial i made is loacted here http://www.rohitab.com/discuss/index.php?showtopic=19510&st=0&p=165699&#entry165699 its small and bearly a tut but its a start for you thers are other ways to do this but im guessing this qwill be the easyist for you i havnt seen ur code so i dunno how its set up but somthing like this may work $_SESSION['keptdir']="/upload.php?file=4"; and you can call this to ur redirection script. hope this helps MofM Link to comment https://forums.phpfreaks.com/topic/101552-can-i-redirect-to-a-page-and-tell-the-page-which-page-i-have-come-from/#findComment-519438 Share on other sites More sharing options...
poleposters Posted April 17, 2008 Author Share Posted April 17, 2008 Thank you both. Great tutorial mofm. I've been using basic sessions but didn't realise I could use them in different ways. Jshiner. Your method is so simple and ingenious.Thank you. You've saved me a ton of time. Cheers Link to comment https://forums.phpfreaks.com/topic/101552-can-i-redirect-to-a-page-and-tell-the-page-which-page-i-have-come-from/#findComment-519450 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.