[eluser]Mareli[/eluser]
Hello.. I hope you can help me
I need to insert multiple values into a database from an array of checkbox, but when i try to do it, I don't get the value of the checkbox, I always get "on". I left the code, so you may check it out, please
Code:
<input type="checkbox" name="etapas[] value="'.$row->idcentrocosto.'"/>.$row->nombre.<br>
Code:
{
if(is_array($_POST['etapas']) && count($_POST['etapas']) >= 1)
{
if($this->model->setMaterial($material))
{
for($i=0;$i<count($_POST['etapas']);$i++)
{
$this->model->setControlMaterial($_POST['etapas'][$i]);
}
}
//redirect('materiales');
}
else
$this->error = "error en insercion de materiales";
$this->addMaterial();
}
And i get this
Code:
An Error Was Encountered
INSERT INTO controlmateria(idcentrocosto) VALUES( "on")
Somebody help me, please