I'm new in Codeignite. I have a "Test" Controller with "index()" and "view($id)" functions. the index method goes to "test1.php" view. In "test1.php", I have a dropdown options. if I submit on this page, the "view" method of "Test" Controller will be called. My question is how can I pass the option value to "view" function , so that the argument of method will be set to the option value and then the url would be something like "http://localhost/test/view/id"
which the id is option value from "test1.php"
Test Controller
class Test extends CI_Controller{
public function indx() {
//some code
$this->load->view('test1.php');
}
public function view($id)
{
//some code, here I use $id which I want to be option value from test1.php
}
test1.php
<?php
$options = array(
'1' => 'One',
'2' => 'Two',
'3' => 'Three',
'4' => 'Four',
);
$js = 'id="shirts" onChange="this.form.submit();"';
echo form_dropdown('shirts', $options, '1', $js);
/* here I want to call echo form_open() as echo form_open("/test/view/[option value]") but I don't know how to do this;*/