![]() |
how to pass variable view -> controller? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: how to pass variable view -> controller? (/showthread.php?tid=5875) |
how to pass variable view -> controller? - El Forum - 02-06-2008 [eluser]jigen7[/eluser] hi im wondring how can you pass a vriable with a data on it to a controller in codeigniter View: Code: <?=anchor('main/edit?id='.$row->id, 'Edit Data');?> then in the Controller Function Code: $this->db->where('id', $_GET['id']); how to pass variable view -> controller? - El Forum - 02-06-2008 [eluser]Armchair Samurai[/eluser] $_GET is disabled by default by CI. Just use get rid of the query string and use slash notation: Code: <?=anchor('main/edit/'.$row->id, 'Edit data');?> how to pass variable view -> controller? - El Forum - 02-06-2008 [eluser]jigen7[/eluser] wow oki thx for the reply how to pass variable view -> controller? - El Forum - 02-06-2008 [eluser]wiredesignz[/eluser] The id value is also passed to your edit function automatically by CI, you dont need to worry about the uri->segment, unless you're using some obscure route. Code: function edit( $id ) //$id = value from uri->segment passed by CI |