Passing Multiple Parameters Using Codeigniters Anchor Function

I’m learning Codeigniter for a project that I am working on. I ran into a problem when I created a controller method that accepts two parameters. My problem was that I did not know how to pass multiple paremeters using Codeigniter’s anchor function. The solution was quite simple in that all I had to do is add additional uri segments to the anchor function.

The controller method takes two arguments:

class Sites extends Controller {
     ...
     function updateVersion($vId, $sId) {
     ...
     }
}

Using the anchor function, I would then call this method that passes 2 as the $vId and 3 as the $sId (/2/3):

echo anchor('members/sites/updateVersion/2/3', 'select');

Simple enough.

Be Sociable, Share!

Checkout My New Site - T-shirts For Geeks