passing url variable - 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 url variable (/showthread.php?tid=30057) |
passing url variable - El Forum - 05-01-2010 [eluser]jmcc1982[/eluser] Hi I would like to pass a variable from my index page to my form page in the url. I have always used page.php?id=1 but now with CI when I try to pass the variable that way I get this error: 404 Page Not Found The page you requested was not found. I appreciate any help. Jay passing url variable - El Forum - 05-01-2010 [eluser]lenwood[/eluser] Take a look at the use of segment in the uri class user guide. Code: $this->uri->segment(n) passing url variable - El Forum - 05-01-2010 [eluser]jmcc1982[/eluser] This is how I reference the link: <a href="<?php site_url('special_deals/form');?>?d=1" class="roll"> This is my Controller: <?php class Special_deals extends Controller { var $data = array(); function Special_deals() { parent::Controller(); $this->data['current_menu_tab'] = "special_deals"; $this->data['message'] = ''; } function index() { } function page($page) { $this->load->view('special_deals/'.$page); } function form() { $this->load->view('special_deals/form'); } } /* End of file welcome.php */ /* Location: ./system/application/controllers/welcome.php */ passing url variable - El Forum - 05-01-2010 [eluser]jmcc1982[/eluser] hi Thanks so do I just add a var to the beginning $var = $this->uri->segment(n) do I need to call anything in my constructor passing url variable - El Forum - 05-01-2010 [eluser]jmcc1982[/eluser] Thanks that worked |