0

i want to send variables when using the codeIgniter form helper.

The function in the controller takes two variables like:

public function doSomething($var1, $var2){

...

}

In the form helper I want to do something like this:

echo form_open('Controller/doSomething($var1, $var2)');
echo form_submit('doIt', 'Do it');  

How can I do this because the above doesn't seem to work.

4

1 回答 1

1

Hidden Fields

echo form_open('controller/method', array('id'=>'id'), array('var1'=>$var1));

OR

Via Route

echo form_open("controller/method/$var1/$var2", array('id'=>'id'));
于 2013-11-10T16:31:43.840 回答