Hola tengo intención de pasar varios campos a base de datos con un for segun el index. Resulta que al ser un for tiene un indice del 0 al 4 y claro se pasan varios pero al pasarlo a base de datos me salta el siguiente error Notice: Undefined index: tr_dia_lunes
PHP _ FORM
for ($l=0; $l<5; $l++){
echo "<td><input type='text' id='dia_lunes_$l' name='tr_dia_lunes_$l' value='$flunes'></td>";
echo "<td><input type='number' min='0' id='tr_fase_lunes_$l' name='tr_fase_lunes_$l' value='0'></td>";
echo "<td><input type='text' id='descripcion_lunes_$l' name='tr_descripcion_lunes_$l' value=''></td>";
echo "<td><input type='number' class='suma_ht_control_lunes' onchange='sumar_ht_control_lunes(),total_fila_lunes($preu_hora), dividir_control_ar_lunes(), total_fila_global(), total_fila_global_ht_control(), total_fila_global_ar_control();' id='ht_control_lunes_$l' name='tr_ht_control_lunes_$l' value='0'></td>";
echo "<td><input type='number' class='suma_unidades_control_lunes' onchange='sumar_unidades_control_lunes(), total_fila_global(), total_fila_lunes($preu_hora),total_fila_global_u_control();' id='unidades_control_lunes_$l' name='tr_unidades_control_lunes_$l' value='0'></td>";
echo "<td><input type='number' class='suma_hh_control_lunes' onchange='total_fila_lunes_tot($l,$preu_hora),sumar_hh_control_lunes(),total_fila_global_hh_control(),total_fila_global(), total_fila_global_ar_control(),total_fila_lunes($preu_hora), total_fila_global(), dividir_control_ar_lunes();' id='hh_control_lunes_$l' name='tr_hh_control_lunes_$l' value='0'></td>";
echo "<td></td>";
echo "<td><input type='number' class='suma_ht_no_control_lunes' onchange='sumar_ht_no_control_lunes(),total_fila_lunes_tot($l,$preu_hora),total_fila_global_ht_no_control(), total_fila_lunes($preu_hora);' id='ht_nocontrol_lunes_$l' name='tr_ht_nocontrol_lunes_$l' value='0'></td>";
echo "<td><input type='number' class='suma_hh_no_control_lunes' onchange='sumar_hh_no_control_lunes(),total_fila_global_hh_no_control(), total_fila_lunes($preu_hora), total_fila_global();' id='hh_nocontrol_lunes_$l' name='tr_hh_nocontrol_lunes_$l' value='0'></td>";
echo "<td><input type='number' class='suma_ht_indirect_lunes' onchange='sumar_ht_indirect_lunes(),total_fila_lunes_tot($l,$preu_hora),total_fila_lunes($preu_hora), total_fila_global();' id='ht_indirect_lunes_$l' name='tr_ht_indirect_lunes_$l' value='0'></td>";
echo "<td><input type='number' class='suma_hh_indirect_lunes' onchange='sumar_hh_indirect_lunes(),total_fila_lunes($preu_hora), total_fila_global();' id='hh_indirect_lunes_$l' name='tr_hh_indirect_lunes_$l' value='0'></td>";
echo "<td><input type='number' class='suma_ht_fest_lunes' onchange='sumar_ht_fest_lunes(),total_fila_lunes_tot($l,$preu_hora),total_fila_lunes($preu_hora), total_fila_global();' id='ht_fest_lunes_$l' name='tr_ht_fest_lunes_$l' value='0'></td>";
echo "<td><input type='number' class='suma_hh_fest_lunes' onchange='sumar_hh_fest_lunes(),total_fila_lunes($preu_hora), total_fila_global();' id='hh_fest_lunes_$l' name='tr_hh_fest_lunes_$l' value='0'></td>";
echo "<td><input type='number' class='total_fila_lunes' id='total_lunes_$l' name='tr_total_lunes_$l' value='0'>€</td>";
echo "</tr>";
}
PHP INSERTBD
if (isset($_POST['action'])){
$id_op = $_POST['operari_sel'];
$fecha_semana = $_POST['fecha_semana'];
for ($l = 0; $l < 5; $l++) {
$tr_dia_lunes = $_POST['tr_dia_lunes_'+$l];
}
$sql_ins="INSERT INTO inn_document_treballador_pieles_semanal VALUES (NULL, '$id_op', '$fecha_semana', '$tr_dia_lunes');";
}}