Haych
Haych

Reputation: 942

Sending a variable in the form helper(CodeIgniter)

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.

Upvotes: 0

Views: 62

Answers (1)

Philip
Philip

Reputation: 4592

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'));

Upvotes: 1

Related Questions