I am working on a CI project and have a need to send data to a controller as a url parameter. I am used to doing something like this.
<a href="site/controller/function?id=1">
Then I am able to grab the parameter using $_GET.
However I was told to use this method.
<a href="site/controller/function/1">
I did this and it shows up in the url when I click on the link, but I have no idea how to grab the actual parameter.
Any advice?
I figured it out, I used the following.
$id=$this->uri->segment(3);
And this got me the id number I passed.
You better should use like below in your codeIgniter function. Even though your code also fine.
function funcName ($param1)
{
echo $param1;
}