Welcome Guest, Not a member yet? Register   Sign In
[solved] cannot get uri segment to work

hi im new to CI and ive been struggling about passing variables in url these past few days;

i understand that i can pass the variable by passing it by segments so i have this


which will catch the cid value (which is 4) in my cid function within my client_profile controller.

Quote:function cid($cid)
echo $cid;

this works fine but i cant seem to find a way to pass that value to my other controllers which will try to do a db query on one of my models.

however i read in the guide that i can also do a $this->uri->segment(3) which i assume will give me the value of 4 but when i try to echo it (for testing purposes) nothing is echoed back in my browser. i also tried assigning it in a variable but echoing that variable returns nothing.

$client_id = $this->uri->segment(3);
echo $client_id;

hope someone can help me figure things out. thank you in advance

It's easy to pass the value into another controller, like this:

Have you tried echoing segments 1 and 2?

[eluser]saidai jagan[/eluser]
I think u shd echo $this->uri->segment(4) Smile

thanks guys i got it working now. thanks for all your help,

i used the first method i stated instead of the $this->uri->segment(n)

i did the model call within the same function too.

Theme © iAndrew 2016 - Forum software by © MyBB