Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/09/2015, 17:25
aris_cielo
 
Fecha de Ingreso: julio-2015
Mensajes: 19
Antigüedad: 8 años, 9 meses
Puntos: 0
Respuesta: hidden que reciban un valor

Esta es la tabla donde al inicio del formulario muestra esta primera fila y el botón de agregar mas filas...

Código HTML:
 <table>
<tr>
  <td><input name="cantidad1" type="text" value="" ></td>
  <td width="415"><input name="producto1" type="text" value=""></td>
  <td><input name="preciou1" type="text" value="" id="preciou1"></td>
  <td><input name="importe1" type="hidden" value="" id="importe1"></td>
</tr>
</table>
<button id="nombrebotton" type="button">Agregar fila</button> 
Este es el código para agregar las filas

$("#nombrebotton").click(function() {
ctr = parseInt($('#hidd_ctr_accion').val());
//console.log(colRangosJS);
setctr = ctr+1;

html = '';
html += ' <table>';
html += ' <tr> \n\
<td><input type="text" name="cantidad'+setctr+'"></td>\n\
<td><input type="text" name="producto'+setctr+'"></td>\n\
<td><input type="text" name="preciou'+setctr+'" ></td>\n\
<td><input type="hidden" name="importe'+setctr+'" ></td>\n\
</tr>';
html += '</table>';

$("#contendor").append(html);
$("#accion").val(ctr+1);
});

Este es el codigo de php que recibe el post para generar el pdf


Código PHP:
<?php
        
for($i=1$i<=$_POST["accion"]; $i++){           
        
?>  
         <tr>
            <td><div> <?php echo $_POST["cantidad".$i]; ?></div></td>
            <td><div> <?php echo $_POST["producto".$i]; ?></div></td>
            <td><div> <?php echo $_POST["preciou".$i]; ?></div></td>
            <td class="txt_der"><div class="campo"><?php echo $_POST['importe'.$i]=$_POST['cantidad'.$i]* $_POST['preciou'.$i]; ?></div></td>
        </tr>
        <?php 
        
?>

y lo que no se es como hacer la suma total de la columna importe ojala puedan ayudarme gracias :)