pass data through url ?

  • Note

    Solution 1 : using function parameter

    in browser , example.com/index.php/product/details/42

    in controller, get as function parameter

    
                      public function details($id) {
                          echo "Product ID is: " . $id;
                      }
                    
    Solution 2 : using $this->uri->segment()

    in browser , example.com/index.php/product/details/42

    in controller, get using url segment

    
                      public function details() {
                          $id = $this->uri->segment(3);
                          echo "Product ID is: " . $id;
                      }