[eluser]pyronate[/eluser]
Hello!
I am having trouble getting my post data from the view to the controller.
I have a function in the controller that obtains data (checkbox and their IDs of those checked) but it does not seem to be getting any of the data, $this->input->post('components') is returning false from within the controller once it is called from the form in the view.
What am I doing wrong? Do I need to be including something so they can "communicate"?
Here's some snippet of code so you guys know what's going on:
view:
Code:
<form action="data/process_action/" action="post">
...
<input type="hidden" name="test" value="should work" />
<input type="checkbox" name="components[]" value="<?php echo $entry['ComponentID'];?>" />
...
</form>
controller:
Code:
function process_action(){
echo "processing action... </br>";
echo $this->input->post('test');
$values = $this->input->post('components');
foreach($values as $value){
echo "CompValue: $value <br />";
}
}
Right now, I'm just trying to get the id's printed out, ideally, I'm trying to setup database calls to delete selected items from the database. All that is being printed out in the controller is "processing action..." and then the message "Invalid argument supplied for foreach()", presumably because it is not receiving the POST data.