How can I pass a variable with anchor() - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: How can I pass a variable with anchor() (/showthread.php?tid=43455) |
How can I pass a variable with anchor() - El Forum - 07-11-2011 [eluser]Hasan Iqbal[/eluser] Hi guys! I'm a newbie in codeigniter. I'm trying to pass an information through anchor() function. Here, I want to attach a variable 'id' that relates to that description and pass it to a controller named 'test'. In that controller I want to retrieve the variable from the URI and do something. But where can i attach it? echo anchor('test',$value->description,''); How can I pass a variable with anchor() - El Forum - 07-12-2011 [eluser]John_Betong_002[/eluser] Try this: Code: echo anchor(‘test/index/id’,$value->description,’‘); How can I pass a variable with anchor() - El Forum - 07-12-2011 [eluser]Naga Gotama Adhiwijaya[/eluser] use this in your view Code: echo anchor("test/some_method/".$value->id, $value->description); and you can get your variable in your "test" controller with this way: Code: function some_method($id) How can I pass a variable with anchor() - El Forum - 07-12-2011 [eluser]Hasan Iqbal[/eluser] thnx.. guys.. it's done.. |