I need to collect all the inputs for 2 reasons:
1º Saber cuantos había.
2º Saber cual fue pulsado.
The problem is that it returns only one position
In the view:
for ($i = 0; $i < 4; $i++) {
echo " <input type='submit' name='btngolpeado[]'
value='¿ Aquí ? '> ";
}
On the controller:
$posicion = $request->get('btngolpeado');
var_dump($posicion);
for($i=0;$i<count($posicion);$i++){
if($posicion[$i] != null){
echo "posicion".$i."fue golpeada";
}
echo "pasada".$i;
}
Press the button that you press, always bring out the same: The var_dump and the execution take:
array(1) { [0]=> string(11) "¿ Aquí ? " } posicion0fue golpeadapasada0