Welcome Guest, Not a member yet? Register   Sign In
retrieve multiple varibles from Input classs
#1

[eluser]Unknown[/eluser]
Is there a way to retrieve multiple variables from the Iput class?
Eg. I have random amount of checkboxes named ckeckbox_1, checkbox_2 .... checkbox_150 and so on
Is there a way to use the Input class in order to cycle through the post data and detect their status?

Thank you in advance for your time and effort
#2

[eluser]Phil Sturgeon[/eluser]
You can use a for loop for that, but I would prefer to do it this way.

Code:
<label>Something: </label>
&lt;?php echo form_input('checkbox[]');?&gt;
<label>Something Else: </label>
&lt;?php echo form_input('checkbox[]');?&gt;
<label>Something again: </label>
&lt;?php echo form_input('checkbox[]');?&gt;

Then in your controller:

Code:
foreach($this->input->post('checkbox') as $value)
{
   echo $value;
}




Theme © iAndrew 2016 - Forum software by © MyBB