Jump to content

Can i redirect to a page and tell the page which page I have come from?


poleposters

Recommended Posts

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?

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!'; }

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.