How to get previous page url in codeigniter?By Hardik Savani | December 20, 2018 | | 2445 Viewer | Category : PHP Codeigniter
Today, i will tech you how to redirect previous page url in codeigniter php. we may sometime require to redirect previous page after login then you can get previous page path by using codeigniter user_agent library, request array or using session.
here, i will show you both example to getting previous page url so, you can simply redirect on that page in codeigniter 3 application.
first we will see user_agent library using referrer() for getting previous page url.
Controller method, using session:
Getting in Controller method:
$previous_url = $this->session->userdata('previous_url');
I hope it can help you....
- Multiple Database Connection in PHP Codeigniter 3
- Codeigniter 3 Datatables Ajax Example From Scratch
- Codeigniter 3 resize image and create thumbnail example
- PHP Codeigniter - Ajax Infinite Scroll Pagination Example
- How to get last record from MySQL table in Codeigniter?
- How to get last inserted id in Codeigniter?
- Codeigniter 3 - select2 ajax autocomplete from database example with demo
- How to get current url with query string in codeigniter?
- Codeigniter - How to get current url in controller or view ?
- How to get Ip Address in Codeigniter?