CodeIgniter Forums

Full Version: Return To Existing URL From Another Controller
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I've got myself into a bit of a pickle and could do with some help and advice on the best way around this.

I'm looking to create a bit of code which can be used from multiple places (controllers) and return the user to the page they were previously on once all processing is completed.

For instance, say im viewing the page ('/staff/view/1').

On this page I have an anchor <?= anchor("call/ring", "Ring"); ?> which directs the user to the call controller firing the 'ring' class to do some processing. Suberb!

Once this processing is done - I want to somehow navigate back to ('staff/view/1') but dont know the best way back!

Can someone please advise?  Huh

Regards,

MoFish
You can create a variable to hold it and also display from the code below.

PHP Code:
if (isset($_SERVER['HTTP_REFERER']))
{
$a $_SERVER['HTTP_REFERER'];
echo 
"Your previous page URL is " $a;
}
else
{
echo 
"You must navigate from index.php page";