ItSolutionStuff.com

How to Get Current URL with Query String in Codeigniter?

By Hardik Savani • November 5, 2023
Codeigniter

If you require to get current URL with parameters in your codeigniter project then you can get easily using "url" helper. Codeigniter provide url helper library that way we can get existing page url or base url etc. you can also get only parameters without URL using "input" as like bellow.

$parameters = $this->input->get();

But, we are getting full path using "url" helper and $_SERVER variable. So, you can see how to get full path using both as bellow:

Example:

$this->load->helper('url');


$currentURL = current_url();

$params = $_SERVER['QUERY_STRING'];


$fullURL = $currentURL . '?' . $params;

print_r($fullURL);

I hope it can help you...

Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

Codeigniter Curl Post Request with Parameters Example

Read Now →

How to Get Current Month Records in Codeigniter?

Read Now →

Codeigniter Form Validation with Error Message

Read Now →

Codeigniter Add/Remove Multiple Input Fields Dynamically using JQuery

Read Now →

How to Get form Post Data in Controller Codeigniter?

Read Now →

How to Get All Tables List in Codeigniter?

Read Now →

Codeigniter Implement Fullcalendar Example Tutorial

Read Now →

Codeigniter Ajax Pagination using JQuery Example

Read Now →

Codeigniter Resize Image and Create Thumbnail Example

Read Now →

Codeigniter Select2 Ajax Autocomplete from Database Example

Read Now →

How to Get Current URL in Codeigniter?

Read Now →

How to Get Current URL in Laravel?

Read Now →

How to Get IP Address in Codeigniter?

Read Now →

Codeigniter 3 and AngularJS CRUD with Search and Pagination Example.

Read Now →