Welcome Guest, Not a member yet? Register   Sign In
passing url variable
#1

[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
#2

[eluser]lenwood[/eluser]
Take a look at the use of segment in the uri class user guide.

Code:
$this->uri->segment(n)
#3

[eluser]jmcc1982[/eluser]
This is how I reference the link:

<a href="&lt;?php site_url('special_deals/form');?&gt;?d=1" class="roll">

This is my Controller:

&lt;?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 */
#4

[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
#5

[eluser]jmcc1982[/eluser]
Thanks that worked

Smile




Theme © iAndrew 2016 - Forum software by © MyBB