I have a problem. I want to put dates into an array but when I make print_r() I get only the last value from checkbox. My code is:
$id = Input::get('id');
$aObjects = Input::get('aObjects');
$iCount = count($aObjects);
for($i=0; $i < $iCount; $i++)
{
$test = array ($aGoupes = array(
'idGroupe' => $id,
'idObject' => $aObjects[$i]
));
}
echo '<pre>';
print_r($test);
echo '</pre>';
The output is:
Array
(
[0] => Array
(
[idGroupe] => 6
[idObject] => 8
)
)
So the problem is that only the last value checked from checkbox is put in this table. Please help me!! Thnx
Your problem is that you're resetting
$testeach time.Try this:
I'm not too sure what your code is supposed to do, but the idGroupe will always be the same in each array, as you're setting it to
$idwhich is never changed. That may well be correct, though.