Sunday 2 October 2016

How to get method to retrieve data from url in CodeIgniter?

It's behavior is fairly intuitive. So, the first parameter you have passes becomes the first segment, the second one becomes the second segment and so on.

Example code:

  1. <?php
  2. class Home extends CI_Controller {
  3.  
  4. public function index($memid, $some_other_parameter)
  5. {
  6. echo $memid;
  7. }
  8. }
  9. ?>


If you call www.example.com?memid=1100, it will echo 1100, provided the Home controller is routed correctly.

You can also use the http://ellislab.com/c to get these parameters.

For your query: $this->input->get('memid', TRUE);

No comments:

Post a Comment

Installation of Drop Box API on Codigniter

As with the YouTube API the first step in getting this sucker setup is getting a developer key by visiting  https://www.dropbox.com/develop...