Jump to content

redirect the page to same location after login


shahzad429

Recommended Posts

You'll need to pass a return URL. For example, in your HTML populate a hidden input with the current URI:

 

<input type="hidden" name="redirect" value="<?php echo urlencode($_SERVER['REQUEST_URI']); ?>" />

 

Ensure you use urlencode to prevent the query string causing problems.

 

Then within the PHP:

 

// all your logic here

if (!empty($_POST['redirect']))
{
    header("Location: " . urldecode($_POST['redirect']));
}

 

You may want to add in some extra security to prevent people inserting their own little URLs, but that's the basics behind it.

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.