Passing parameter to controller method fails - 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: Passing parameter to controller method fails (/showthread.php?tid=49500) |
Passing parameter to controller method fails - El Forum - 02-22-2012 [eluser]Kimse[/eluser] Hi I have an url like this http://exmaple.com/video/1 and route like this: Code: $route['video/:num'] = 'players/video/$1'; and my controller method: Code: public function video($video_id) { this is the var_dump output: Quote:string(2) "$1" and I expected $video_id to contain 1 Passing parameter to controller method fails - El Forum - 02-22-2012 [eluser]meigwilym[/eluser] You need parentheses around :num for the regex to pass the value. Code: $route['video/(:num)'] = 'players/video/$1'; Mei Passing parameter to controller method fails - El Forum - 02-22-2012 [eluser]Kimse[/eluser] [quote author="meigwilym" date="1329922967"]You need parentheses around :num for the regex to pass the value. Code: $route['video/(:num)'] = 'players/video/$1'; Mei[/quote] ah damn it! of course. I feel so stupid hehe but thanks alot! |