Los arreglos vienen de aqui:
Código HTML:
Ver original<form action="nomina_reg.php" method="get" name="form1" onfocus="validar();" > <table width="750" border="0" class="tabla2"> <td colspan="5" class="td2" bgcolor="#95bce2">UNIDAD EDUCATIVA EL MILAGRO DE LA PERLA
</td> <td colspan="5">NOMINA PARA EL PAGO DE SUELDOS EMPLEADOS
</td> <p>Fecha Desde:
<input type="text" id="datepicker_1" name="desde" class="fechador"></p> <p>Fecha Hasta:
<input type="text" id="datepicker_2" name="hasta" class="fechador"></p> <table width="750" border="1" bordercolor="#95bce2" class="tabla3"> <td width="3%" class="td3">Nº
</td> <td width="3%" class="td3">CI
</td> <td width="10%" class="td3">APELLIDOS
</td> <td width="11%" class="td3">NOMBRES
</td> <td width="4%" class="td3">DIAS
</td> <td width="8%" class="td3">SUELDO BÁSICO
</td> <td width="8%" class="td3">SUELDO DIARIO
</td> <td width="8%" class="td3">SUELDO B. QUINCENA
</td> <td width="8%" class="td3">IVSS
</td> <td width="8%" class="td3">PARO FORSOZO
</td> <td width="8%" class="td3">LPH
</td> <td width="8%" class="td3">OTROS DESCUENT
</td> <td width="8%" class="td3">OTROS INGRESOS
</td> <td width="8%" class="td3">TOTAL DEDUCCIONES
</td> <td width="8%" class="td3">TOTAL DEVENGADO
</td>
<?php
$indice = 1;
$indice2 = 1;
$indice3 = 1;
//$indice4 = 1;
$rs = mysql_query("SELECT * FROM empleados ORDER BY id_empleado ASC");
while($result = mysql_fetch_array($rs)) {
// Realmente no necesitas hacer todas las asignaciones que tienes
// Sólo estás agregando más código, siempre puedes incluir...
// ... elementos de array en cadenas usando {$result['indice']}
$ivss = number_format(($result['sueldo_basico']*4/100),2,'.','');
$paro_for = number_format(($result['sueldo_basico']*0.5/100),2,'.','');
$lph = number_format(($result['sueldo_basico']*1/100),2,'.','');
$sueldo_diario = $result['sueldo_basico']/30;
// Para facilitar un poco las cosas, habrá que agregar un campo oculto...
// ...con la id de empleado
?>
<td><?php echo $result['id_empleado']; ?><input type="hidden" name="id_empleado[]" value="<?php echo $result['id_empleado']; ?>" />
</td> <td><?php echo $result['ci']; ?></td> <td><?php echo "{$result['papellido']} {$result['sapellido']}"; ?></td> <td><?php echo "{$result['pnombre']} {$result['snombre']}"; ?></td>
<td><input name="dias[]" type="text" id="dias<?php echo $indice; ?>" size="2" value="" onBlur="calcula(this.value, '
<?php echo $sueldo_diario; ?>',
<?php echo $indice; ?>);" />
</td> <td><label name="sueldo_basico" id="sueldo_basico" size="2" readonly="readonly" value="" ><?php echo $result['sueldo_basico']; ?></label></td> <td><input type="text" name="sueldo_diario[]" id="sueldo_diario" size="5" readonly="readonly" value="<?php echo $sueldo_diario; ?>" >
</td> <td><input name="sueldo_quinc[]" type="text" id="sueldo_quinc<?php echo $indice; ?>" size="5" value="" readonly="readonly" />
</td>
<td><input type="text" name="ivss[]" id="ivss" size="3" readonly="readonly" value="<?php echo $ivss; ?>" />
</td> <td><input type="text" name="paro_for[]" id="paro_for" size="3" readonly="readonly" value="<?php echo $paro_for; ?>" >
</td> <td><input type="text" name="lph[]" id="lph" size="3" readonly="readonly" value="<?php echo $lph; ?>" >
</td>
<td><input name="otros_desc[]" type="text" id="otros_desc<?php echo $indice2; ?>" size="5" value="" onBlur="deducciones(this.value, '
<?php echo $ivss; ?>', '
<?php echo $paro_for; ?>', '
<?php echo $lph; ?>',
<?php echo $indice2; ?>);" />
</td> <td><input name="otros_ing[]" type="text" id="otros_ing<?php echo $indice3; ?>" size="5" value="" onChange="total_dev(this.value, sq, dd,
<?php echo $indice3; ?>);" />
</td>
<td><input name="total_deducc[]" type="text" id="total_deducc<?php echo $indice2; ?>" size="5" value="" readonly="readonly" />
</td> <td><input name="total_deveng[]" type="text" id="total_deveng<?php echo $indice3; ?>" size="5" value="" readonly="readonly" />
</td> <?php
$indice ++;
$indice2 ++;
$indice3 ++;
//$indice4 ++;
} // fin de while
<td class="td3">TOTAL
</td> <td><input type="text" id="total" name="total" size="5" value="" readonly="readonly" onMouseOver="javascript:totalizar();" /></td> <!-- <A href="javascript:totalizar()">Ver valores</A>-->
<th colspan="2"><input type="submit" name="button" id="button" value="Guardar" />