Ver Mensaje Individual
  #20 (permalink)  
Antiguo 24/05/2012, 09:47
Avatar de informacionsys
informacionsys
 
Fecha de Ingreso: mayo-2011
Ubicación: Bogota D.C
Mensajes: 793
Antigüedad: 13 años
Puntos: 76
Respuesta: Como imprimo desde un for

hola como estas


seria algo asi, pruebalo:

Código HTML:
Ver original
  1. <DOCTYPE html PUBLIC "- / / W3C / / DTD XHTML 1.0 Strict / / EN" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2.  
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
  4.  
  5. <!-- Se llama el archivo  jquery.min.js -->
  6. <script type="text/javascript" src="js/jquery.min.js"></script>
  7.  
  8.  
  9. <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
  10.  
  11. <title>ETIQUETA DE CUARENTENA</title>
  12.  
  13. <!-- Se llama el archivo  js/Ajax.js este archivo contiene las funciones de validaciones. -->
  14. <script language="JavaScript" type="text/javascript" src="Ajax.js"></script>
  15.  
  16. <!-- Se llama el archivo  js/Ajax.js este archivo contiene las funciones de validaciones -->
  17. <script language="JavaScript" type="text/javascript" src="js/funciones.js"></script>
  18.  
  19. <style media="print" type="text/css">
  20. #imprimir {
  21. visibility:hidden
  22. }
  23. #cambiar{
  24. visibility:hidden
  25. }
  26.  
  27. /*Imprime el formulario Previa.php y luego lo cierra*/
  28.      function imprSelec()
  29.       {
  30.         window.print();
  31.         window.close('Previa.php');
  32.         window.open('Cuarentena.php');
  33.       }
  34.  
  35. </head>
  36.  
  37. <!-- Scripts que se llaman a los js -->
  38. <script language="JavaScript" src="js/jquery-1.5.1.min.js"></script>
  39.  
  40. <script language="JavaScript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
  41.  
  42. <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.13.custom.css" rel="stylesheet"/>
  43.  
  44.  
  45. <?php
  46.  
  47. /*Variables que toman el valor de los campos, para luego mostrarlos en el formulario como vista previa
  48. require('Conexion.php');
  49.  
  50. $Producto = $_POST['Producto'];
  51.  
  52. $Lote=$_POST['Nolote'];
  53.  
  54. $Proveedor=$_POST['proveedor'];
  55.  
  56. $Cliente=$_POST['Cliente'];
  57.  
  58. $Recipiente=$_POST['Recipiente'];
  59.  
  60. $De=$_POST['de'];
  61.  
  62. $Empaque=$_POST['empaque'];
  63.  
  64. $Fecha=$_POST['fecha'];
  65.  
  66. $Total=$_POST['total'];
  67.  
  68. $Responsable=$_POST['responsable'];
  69.  
  70. $Fecha1=$_POST['fecha1'];
  71.  
  72. $Observaciones=$_POST['observaciones'];
  73. */    /*Muestra tantas veces como se le indique en el (for)*/
  74.    for ($i=1; $i<=$Total ; $i++){
  75.    
  76.    ?>
  77. <!--    -->
  78.  
  79. <?php
  80. if($i % 2 == 0) {
  81. echo '<div style="float:left;border:1px solid #333;height:450px">';
  82. } else {
  83. echo '<div style="clear:both;float:left;border:1px solid #333;height:450px">';
  84. }
  85. ?>
  86.  
  87. <form id="form1" name="form1" method="POST" action="modificar.php?Lotes=<?php echo $Lote; ?>">
  88.  
  89.   <table width="61%"  border="0" style="border:0px solid #333;">
  90.   <tr>
  91.     <th height="47" scope="col"><center><H2><font face="Arial, Helvetica, sans-serif">
  92.         <img src="Cuarentena.png" style="margin: 0px 0px 18px 15px;float: left;"/>CUARENTENA</font></H2></center>
  93.     </th>
  94.   </tr>
  95.  
  96.   <table width="61%" border="0">
  97.    
  98.     <tr>
  99.     <th colspan="2">Material: <input name="Producto" type="text" size="35" value="<?php echo $Producto ?>  "/></th>
  100.     </tr>
  101.  
  102.     <tr>
  103.     <th colspan="2">Lote: <input name="Nolote" type="text" size="6" value="<?php echo $Lote ?>"/>   Proveedor: <input name="proveedor" type="text" size="15" value="<?php echo $Proveedor ?>"/></th>
  104.     </tr>
  105.    
  106.     <tr>
  107.     <th colspan="2">Cliente: <input name="Cliente" type="text" size="37" value="<?php echo $Cliente ?> "/></th>
  108.     </tr>
  109.    
  110.     <tr>
  111.     <th colspan="2">No.Recip: <input name="Recipiente" type="text" size="1"  value="  <?php echo $i ?>"/> de <input name="de" type="text" size="1" value="  <?php echo $Total ?>"/> /Und.Emp: <input name="empaque" type="text" size="6" value=" <?php echo $Empaque ?>"/></th>
  112.     </tr>
  113.    
  114.     <tr>
  115.     <th colspan="2">Vencimiento: <input size="4" id="fc_1333032142" type="text" READONLY name="fecha" title="YYMMDD" onClick="displayCalendar(this);" value="<?php echo $Fecha ?>"> Cant.Total:  <input name="total" type="text" size="7" value="<?php echo $De ?>"/></th>
  116.     </tr>
  117.    
  118.     <tr>
  119.     <th colspan="2">Responsable: <input name="responsable" type="text" size="13" value="<?php echo $Responsable ?>"/> Fecha: <input name="fecha1" id="fc_1331842667" type="text" READONLY  title="YYMMDD" onClick="displayCalendar(this);" size="4" value="<?php echo $Fecha1 ?>"/></th>
  120.     </tr>
  121.    
  122.     <tr>
  123.     <th height="26" colspan="2">Observaciones: <input name="observaciones" type="text" size="27" value="   <?php echo $Observaciones ?>"/></th>
  124.     </tr>
  125.  
  126. </table>
  127.  
  128. </form>
  129.  
  130. </div>    
  131.  
  132.  
  133.  
  134.  
  135. <form id="form1" name="form1" method="POST" action="modificar.php?Lotes=<?php echo $Lote; ?>">
  136.  
  137.  
  138.  
  139.  
  140.     <?php
  141.    
  142.    }
  143.    
  144.    ?>
  145.  
  146. <div id="noprint">
  147.                                                                  
  148. <input type="button" name="imprimir" id="imprimir" value="IMPRIMIR"  onClick="javascript:imprSelec();" />  <a href="modificar.php?Lotes=<?php echo $Lote; ?>" id="cambiar" name="cambiar">.:::Cambiar Datos:::.</a>
  149.  
  150. <!--<input type="submit" name="imprimir" id="imprimir" value="IMPRIMIR" />-->
  151.  
  152. </div>
  153.  
  154. </form>
  155.  
  156.  
  157. </body>
  158.  
  159. </html>