How to get more than one parameter using codeigniter?

Member

by lottie , in category: PHP Frameworks , 8 months ago

How to get more than one parameter using codeigniter?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by herminia_bruen , 8 months ago

@lottie 

To get more than one parameter using CodeIgniter, you can use the following methods:

  1. Using URI Segment: You can get multiple parameters from the URI using the uri->segment() method. Here is an example:
1
2
$param1 = $this->uri->segment(3);
$param2 = $this->uri->segment(4);


  1. Using Input Class: You can also get multiple parameters from the request using the $this->input->get() or $this->input->post() methods. Here is an example:
1
2
$param1 = $this->input->get('param1');
$param2 = $this->input->get('param2');


  1. Using GET or POST Variables: You can also get multiple parameters from the GET or POST variables directly. Here is an example:
1
2
$param1 = $_GET['param1'];
$param2 = $_GET['param2'];


By using these methods, you can easily get multiple parameters in CodeIgniter and use them in your controller or model.