Foros del Web » Creando para Internet » CSS »

Como imprimo desde un for

Estas en el tema de Como imprimo desde un for en el foro de CSS en Foros del Web. Hola necesito un favor no se si sea bobada o que pero no he podido hacerlo, yo imprimo un formulario tantas veces como se indica ...

  #1 (permalink)  
Antiguo 24/05/2012, 07:01
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Como imprimo desde un for

Hola necesito un favor no se si sea bobada o que pero no he podido hacerlo, yo imprimo un formulario tantas veces como se indica en el for y me lo imprime, pero necesito que me imprima una al llado de la otra no hacia a bajo, Ejemplo me esta imprimiento

1
2
3
4
5
6

necesito que me imprima

1 2
3 4
5 6

como podria realizar esto Muchas Gracias por toda la ayuda prestada
  #2 (permalink)  
Antiguo 24/05/2012, 07:14
 
Fecha de Ingreso: noviembre-2010
Ubicación: Munich - Alemania
Mensajes: 76
Antigüedad: 13 años, 5 meses
Puntos: 7
Respuesta: Como imprimo desde un for

Cita:
Iniciado por JeMaGa Ver Mensaje
Hola necesito un favor no se si sea bobada o que pero no he podido hacerlo, yo imprimo un formulario tantas veces como se indica en el for y me lo imprime, pero necesito que me imprima una al llado de la otra no hacia a bajo, Ejemplo me esta imprimiento

1
2
3
4
5
6

necesito que me imprima

1 2
3 4
5 6

como podria realizar esto Muchas Gracias por toda la ayuda prestada
Hola JeMaGa,

Supongo que te refieres a formularios html no? lo que quieres es que los divs o tablas se alineen a la izquierda. Si puedes pon un trozo de código para hacerme una idea.

Saludos,
  #3 (permalink)  
Antiguo 24/05/2012, 07:26
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

Mira este es el codigo, aqui esta el for que muestra la tabla que necesito mostrar pero necesito que se muestre 1 2, abajo 3 4, abajo 5 6 y haci susesivamente

Código PHP:
Ver original
  1. for ($i=1; $i<=$Total; $i++){
  2.    
  3.     ?>
  4. <!--    -->
  5.  
  6. <form id="form1" name="form1" method="POST" action="modificar.php?Lotes=<?php echo $Lote; ?>">
  7.  
  8. <table width="100%">
  9.   <tr>
  10.   <td>
  11.  
  12.   <div id="myDiv">
  13. <table width="47%"  border="1">
  14.   <tr>
  15.     <th height="47" scope="col"><center><H2><font face="Arial, Helvetica, sans-serif"><img src="Cuarentena.png" style="margin: 0px 0px 18px 15px;float: left; "/>CUARENTENA</font></H2></center></th>
  16.   </tr>
  17. </table>
  18.  
  19.   <table width="47%" border="1">
  20.    
  21.     <tr>
  22.     <th colspan="2">Material: <input name="Producto" type="text" size="35" value="<?php echo $Producto ?>  "/></th>
  23.     </tr>
  24.  
  25.     <tr>
  26.     <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>
  27.     </tr>
  28.    
  29.     <tr>
  30.     <th colspan="2">Cliente: <input name="Cliente" type="text" size="37" value="<?php echo $Cliente ?> "/></th>
  31.     </tr>
  32.    
  33.     <tr>
  34.     <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="7" value=" <?php echo $Empaque ?>"/></th>
  35.     </tr>
  36.    
  37.     <tr>
  38.     <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="8" value="<?php echo $De ?>"/></th>
  39.     </tr>
  40.    
  41.     <tr>
  42.     <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>
  43.     </tr>
  44.    
  45.     <tr>
  46.     <th height="26" colspan="2">Observaciones: <input name="observaciones" type="text" size="28" value="   <?php echo $Observaciones ?>"/></th>
  47.     </tr>
  48.  
  49. </table>
  50.     </div>
  51.  
  52.     <br/><br/>
  53.  
  54.     <?php
  55.    
  56.     }
  57.    
  58.     ?>
  #4 (permalink)  
Antiguo 24/05/2012, 07:27
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

perdona la orografia :)
  #5 (permalink)  
Antiguo 24/05/2012, 07:47
 
Fecha de Ingreso: noviembre-2010
Ubicación: Munich - Alemania
Mensajes: 76
Antigüedad: 13 años, 5 meses
Puntos: 7
Respuesta: Como imprimo desde un for

Cita:
Iniciado por JeMaGa Ver Mensaje
Mira este es el codigo, aqui esta el for que muestra la tabla que necesito mostrar pero necesito que se muestre 1 2, abajo 3 4, abajo 5 6 y haci susesivamente

Código PHP:
Ver original
  1. for ($i=1; $i<=$Total; $i++){
  2.    
  3.     ?>
  4. <!--    -->
  5.  
  6. <form id="form1" name="form1" method="POST" action="modificar.php?Lotes=<?php echo $Lote; ?>">
  7.  
  8. <table width="100%">
  9.   <tr>
  10.   <td>
  11.  
  12.   <div id="myDiv">
  13. <table width="47%"  border="1">
  14.   <tr>
  15.     <th height="47" scope="col"><center><H2><font face="Arial, Helvetica, sans-serif"><img src="Cuarentena.png" style="margin: 0px 0px 18px 15px;float: left; "/>CUARENTENA</font></H2></center></th>
  16.   </tr>
  17. </table>
  18.  
  19.   <table width="47%" border="1">
  20.    
  21.     <tr>
  22.     <th colspan="2">Material: <input name="Producto" type="text" size="35" value="<?php echo $Producto ?>  "/></th>
  23.     </tr>
  24.  
  25.     <tr>
  26.     <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>
  27.     </tr>
  28.    
  29.     <tr>
  30.     <th colspan="2">Cliente: <input name="Cliente" type="text" size="37" value="<?php echo $Cliente ?> "/></th>
  31.     </tr>
  32.    
  33.     <tr>
  34.     <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="7" value=" <?php echo $Empaque ?>"/></th>
  35.     </tr>
  36.    
  37.     <tr>
  38.     <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="8" value="<?php echo $De ?>"/></th>
  39.     </tr>
  40.    
  41.     <tr>
  42.     <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>
  43.     </tr>
  44.    
  45.     <tr>
  46.     <th height="26" colspan="2">Observaciones: <input name="observaciones" type="text" size="28" value="   <?php echo $Observaciones ?>"/></th>
  47.     </tr>
  48.  
  49. </table>
  50.     </div>
  51.  
  52.     <br/><br/>
  53.  
  54.     <?php
  55.    
  56.     }
  57.    
  58.     ?>
Ok, tu problemas es más de HTML y CSS que de PHP.

Mi solución sería meter todo el formulario en un DIV y a este darle estilo, algo así:

Código PHP:
 <div style="border: 1px solid red; width: 45%; float: left; margin-right: 5px;">
    <!-- Aquí empezaría tu código -->
<form id="form1" name="form1" method="POST" action="modificar.php?Lotes=<?php echo $Lote?>">
     
    <table width="100%">
      <tr>
      <td>
       .......
</div>
Esta línea la podrías quitar: border: 1px solid red; solo la pongo para que veas cuanto ocupa tu div (width: 45%) ese valor también lo puedes modificar.

Saludos,
  #6 (permalink)  
Antiguo 24/05/2012, 07:58
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

Gracias por tu ayuda con estilo consigo el resultado esperado, es que no es que entienda muy bien css que pena contigo!! :)
  #7 (permalink)  
Antiguo 24/05/2012, 08:04
 
Fecha de Ingreso: noviembre-2010
Ubicación: Munich - Alemania
Mensajes: 76
Antigüedad: 13 años, 5 meses
Puntos: 7
Respuesta: Como imprimo desde un for

No tienes que disculparte, para eso está el foro.
  #8 (permalink)  
Antiguo 24/05/2012, 08:10
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

mm que pena pero me pongo a mover las propiedades del div pero no logro hacer que me muestre uno al lado del otro, se sigue mostrando uno abajo del otro
  #9 (permalink)  
Antiguo 24/05/2012, 08:21
 
Fecha de Ingreso: noviembre-2010
Ubicación: Munich - Alemania
Mensajes: 76
Antigüedad: 13 años, 5 meses
Puntos: 7
Respuesta: Como imprimo desde un for

Cita:
Iniciado por JeMaGa Ver Mensaje
mm que pena pero me pongo a mover las propiedades del div pero no logro hacer que me muestre uno al lado del otro, se sigue mostrando uno abajo del otro
Yo he probado el código que copiaste y le he añadido el div que te dije y me funciona. Que navegador usas?
  #10 (permalink)  
Antiguo 24/05/2012, 08:22
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

Mozilla Firefox
  #11 (permalink)  
Antiguo 24/05/2012, 08:24
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

Y lo probe en explorer y tampoco
  #12 (permalink)  
Antiguo 24/05/2012, 08:26
 
Fecha de Ingreso: noviembre-2010
Ubicación: Munich - Alemania
Mensajes: 76
Antigüedad: 13 años, 5 meses
Puntos: 7
Respuesta: Como imprimo desde un for

Agrega estas lineas entre las etiquetas <head></head> y me dices si funciona.

<head>
<META content="text/html; charset=UTF-8" http-equiv=Content-Type>
<META http-equiv="X-UA-Compatible" content="IE=100">
</head>
  #13 (permalink)  
Antiguo 24/05/2012, 08:32
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

No sigue igual me sale la tabla toda estirada una debajo de la otra,
  #14 (permalink)  
Antiguo 24/05/2012, 08:33
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

sale asi [URL="http://localhost/TOMARDATOS.php"]http://localhost/TOMARDATOS.php[/URL]
  #15 (permalink)  
Antiguo 24/05/2012, 08:34
 
Fecha de Ingreso: noviembre-2010
Ubicación: Munich - Alemania
Mensajes: 76
Antigüedad: 13 años, 5 meses
Puntos: 7
Respuesta: Como imprimo desde un for

Si no funciona es por que estás poniendo el estilo donde no corresponde. El código que copiaste en los post anteriores, es el código completo de tu página? es que no veo etiquetas <html><head><body> es importante no olvidarse de esto.

Saludos,
  #16 (permalink)  
Antiguo 24/05/2012, 08:36
 
Fecha de Ingreso: noviembre-2010
Ubicación: Munich - Alemania
Mensajes: 76
Antigüedad: 13 años, 5 meses
Puntos: 7
Respuesta: Como imprimo desde un for

Cita:
Iniciado por JeMaGa Ver Mensaje
sale asi [URL="http://localhost/TOMARDATOS.php"]http://localhost/TOMARDATOS.php[/URL]
Eso yo no lo puedo ver por que trabajas en local, si quieres puedes adjuntar una captura de pantalla.
  #17 (permalink)  
Antiguo 24/05/2012, 08:38
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

no ese no es el codigo completo ................... Este si es el codigo completo

Código PHP:
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. <head>
  9.  
  10. <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
  11.  
  12. <title>ETIQUETA DE CUARENTENA</title>
  13.  
  14. <!-- Se llama el archivo  js/Ajax.js este archivo contiene las funciones de validaciones. -->
  15. <script language="JavaScript" type="text/javascript" src="Ajax.js"></script>
  16.  
  17. <!-- Se llama el archivo  js/Ajax.js este archivo contiene las funciones de validaciones -->
  18. <script language="JavaScript" type="text/javascript" src="js/funciones.js"></script>
  19.  
  20. <style media="print" type="text/css">
  21. #imprimir {
  22. visibility:hidden
  23. }
  24. #cambiar{
  25. visibility:hidden
  26. }
  27. </style>
  28.  
  29. <script>
  30. /*Imprime el formulario Previa.php y luego lo cierra*/
  31.      function imprSelec()
  32.       {
  33.         window.print();
  34.         window.close('Previa.php');
  35.         window.open('Cuarentena.php');
  36.       }
  37. </script>
  38.  
  39. </head>
  40.  
  41. <!-- Scripts que se llaman a los js -->
  42. <script language="JavaScript" src="js/jquery-1.5.1.min.js"></script>
  43.  
  44. <script language="JavaScript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
  45.  
  46. <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.13.custom.css" rel="stylesheet"/>
  47.  
  48. <body>
  49.  
  50. <?php
  51.  
  52. /*Variables que toman el valor de los campos, para luego mostrarlos en el formulario como vista previa*/
  53. require('Conexion.php');
  54.  
  55. $Producto = $_POST['Producto'];
  56.  
  57. $Lote=$_POST['Nolote'];
  58.  
  59. $Proveedor=$_POST['proveedor'];
  60.  
  61. $Cliente=$_POST['Cliente'];
  62.  
  63. $Recipiente=$_POST['Recipiente'];
  64.  
  65. $De=$_POST['de'];
  66.  
  67. $Empaque=$_POST['empaque'];
  68.  
  69. $Fecha=$_POST['fecha'];
  70.  
  71. $Total=$_POST['total'];
  72.  
  73. $Responsable=$_POST['responsable'];
  74.  
  75. $Fecha1=$_POST['fecha1'];
  76.  
  77. $Observaciones=$_POST['observaciones'];
  78.  
  79.     /*Muestra tantas veces como se le indique en el (for)*/
  80.     for ($i=1; $i<=$Total; $i++){
  81.    
  82.     ?>
  83. <!--    -->
  84. <div style="border: 1px solid red; width: 45%; float: left; margin-right: 5px;">
  85. <form id="form1" name="form1" method="POST" action="modificar.php?Lotes=<?php echo $Lote; ?>">
  86.  
  87.   <div id="myDiv">
  88. <table width="61%"  border="1">
  89.   <tr>
  90.     <th height="47" scope="col"><center><H2><font face="Arial, Helvetica, sans-serif"><img src="Cuarentena.png" style="margin: 0px 0px 18px 15px;float: left; "/>CUARENTENA</font></H2></center></th>
  91.   </tr>
  92. </table>
  93.  
  94.   <table width="61%" border="1">
  95.    
  96.     <tr>
  97.     <th colspan="2">Material: <input name="Producto" type="text" size="35" value="<?php echo $Producto ?>  "/></th>
  98.     </tr>
  99.  
  100.     <tr>
  101.     <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>
  102.     </tr>
  103.    
  104.     <tr>
  105.     <th colspan="2">Cliente: <input name="Cliente" type="text" size="37" value="<?php echo $Cliente ?> "/></th>
  106.     </tr>
  107.    
  108.     <tr>
  109.     <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>
  110.     </tr>
  111.    
  112.     <tr>
  113.     <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>
  114.     </tr>
  115.    
  116.     <tr>
  117.     <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>
  118.     </tr>
  119.    
  120.     <tr>
  121.     <th height="26" colspan="2">Observaciones: <input name="observaciones" type="text" size="27" value="   <?php echo $Observaciones ?>"/></th>
  122.     </tr>
  123.  
  124. </table>
  125.     </div>
  126.  
  127.     <br/><br/>
  128.  
  129.     <?php
  130.    
  131.     }
  132.    
  133.     ?>
  134.  
  135. <div id=noprint>
  136.                                                                  
  137. <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>
  138.  
  139. <!--<input type="submit" name="imprimir" id="imprimir" value="IMPRIMIR" />-->
  140.  
  141. </div>
  142.  
  143. </form>
  144. </div>
  145. <p>&nbsp;</p>
  146.  
  147. </body>
  148.  
  149. </html>
  #18 (permalink)  
Antiguo 24/05/2012, 08:59
 
Fecha de Ingreso: noviembre-2010
Ubicación: Munich - Alemania
Mensajes: 76
Antigüedad: 13 años, 5 meses
Puntos: 7
Respuesta: Como imprimo desde un for

Cuando llegue a casa lo pruebo y te digo, pero es sólo problema del estilo.
  #19 (permalink)  
Antiguo 24/05/2012, 09:04
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

Muchas Gracias!!
  #20 (permalink)  
Antiguo 24/05/2012, 09:47
Avatar de informacionsys  
Fecha de Ingreso: mayo-2011
Ubicación: Bogota D.C
Mensajes: 793
Antigüedad: 12 años, 11 meses
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>
  #21 (permalink)  
Antiguo 24/05/2012, 10:19
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

Si eso era lo que necesitaba Muchas gracias por tu ayuda, toca areglar el estilo pero si Muchas gracias!!
  #22 (permalink)  
Antiguo 24/05/2012, 13:32
 
Fecha de Ingreso: noviembre-2010
Ubicación: Munich - Alemania
Mensajes: 76
Antigüedad: 13 años, 5 meses
Puntos: 7
Respuesta: Como imprimo desde un for

Me alegro que lo hayas podido solucionar, veo que he llegado tarde.
  #23 (permalink)  
Antiguo 24/05/2012, 13:50
 
Fecha de Ingreso: marzo-2012
Ubicación: Republica Dominicana
Mensajes: 51
Antigüedad: 12 años, 1 mes
Puntos: 3
Respuesta: Como imprimo desde un for

Código PHP:
Ver original
  1. <?php
  2. echo"<table>";
  3. for($a=0; $a<=13; $a++){
  4. if($a%2==0){
  5. echo"<tr><td>$a</td>";
  6. }else{
  7. echo"<td>$a</td></tr>";
  8. }
  9. }
  10. echo"</table>";
  11. ?>

una vez tenia ese problema y de esta forma fue como lo resolvi espero que te pueda ayudar con esto
  #24 (permalink)  
Antiguo 24/05/2012, 14:45
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

Gracias por toda la ayuda es muy valiosa!! :)
  #25 (permalink)  
Antiguo 25/05/2012, 08:48
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

Hola me surgio un problemita, yo probe el codigo en mozilla y hay funciona bien, pero lo pruebo en explorer y me muestra uno debajo del otro, que podria hacer ?? agradezco la ayuda
  #26 (permalink)  
Antiguo 25/05/2012, 08:58
Avatar de jotaincubus  
Fecha de Ingreso: mayo-2005
Ubicación: Medellin - Colombia
Mensajes: 1.797
Antigüedad: 18 años, 11 meses
Puntos: 394
Respuesta: Como imprimo desde un for

El "Problema" (lo coloco entre comillas porque para mi no es un problema) es que firefox organiza los codigos en los cuales el desarrollador se equivoque... por ejemplo si tu tienes una etiqueta <select> y no la cierras, firefox y otros navegadores lo cierran por ti, cosa que no hace la belleza de IE entonces para mi el problema debe estar en el codigo HTML generado... dale en el IE ver codigo fuente y fijate que no hayan etiquetas abiertas a ver si ese es el problema.
__________________
Por que existe gente que no agradece después de que se le ha brindado tiempo y ayuda ???
  #27 (permalink)  
Antiguo 25/05/2012, 09:49
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

revise parte por parte y como tu me dices que mozilla aregla los errores del programador en tonces, copie el codigo fuete de mozilla a un archivo, y ese archivo lo ejecuto en explorer, y me da igual uno debajo de otro!! ayuda!!
  #28 (permalink)  
Antiguo 25/05/2012, 10:19
Avatar de jotaincubus  
Fecha de Ingreso: mayo-2005
Ubicación: Medellin - Colombia
Mensajes: 1.797
Antigüedad: 18 años, 11 meses
Puntos: 394
Respuesta: Como imprimo desde un for

Entonces debe ser que algun estilo CSS esta siendo ignorado por IE... si tienes IE 9 este tiene una vista de desarrollador que te muestra las reglas CSS... creo que lo sacas con F12
__________________
Por que existe gente que no agradece después de que se le ha brindado tiempo y ayuda ???
  #29 (permalink)  
Antiguo 25/05/2012, 11:50
Avatar de informacionsys  
Fecha de Ingreso: mayo-2011
Ubicación: Bogota D.C
Mensajes: 793
Antigüedad: 12 años, 11 meses
Puntos: 76
Respuesta: Como imprimo desde un for

hola como estas?

muestra como tiene el codigo
  #30 (permalink)  
Antiguo 28/05/2012, 15:10
Avatar de JeMaGa  
Fecha de Ingreso: julio-2011
Ubicación: Bogota
Mensajes: 430
Antigüedad: 12 años, 9 meses
Puntos: 4
Respuesta: Como imprimo desde un for

Gracias por la ayuda!!!

Código PHP:
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. <head>
  9.  
  10. <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
  11.  
  12. <title>ETIQUETA DE CUARENTENA</title>
  13.  
  14. <!-- Se llama el archivo  js/Ajax.js este archivo contiene las funciones de validaciones. -->
  15. <script language="JavaScript" type="text/javascript" src="Ajax.js"></script>
  16.  
  17. <!-- Se llama el archivo  js/Ajax.js este archivo contiene las funciones de validaciones -->
  18. <script language="JavaScript" type="text/javascript" src="js/funciones.js"></script>
  19.  
  20. <style media="print" type="text/css">
  21. #imprimir {
  22. visibility:hidden
  23. }
  24. #cambiar{
  25. visibility:hidden
  26. }
  27. </style>
  28.  
  29. <script>
  30. /*Imprime el formulario Previa.php y luego lo cierra*/
  31. function imprSelec()
  32. {
  33. window.print();
  34. window.close('Previa.php');
  35. window.open('Cuarentena.php');
  36. }
  37. </script>
  38.  
  39. </head>
  40.  
  41.       <script language="JavaScript" src="js/jquery-1.5.1.min.js"></script>
  42.  
  43.       <script language="JavaScript" src="js/jquery-ui-1.8.13.custom.min.js"></script>
  44.  
  45.       <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.13.custom.css" rel="stylesheet"/>
  46.  
  47.       <body>
  48.  
  49.       <?php
  50.  
  51.          for ($i=1; $i<=$Total ; $i++){
  52.  
  53. if($i % 2 == 0) {
  54.  
  55. echo '<div style="float:right;height:305px">';
  56.  
  57. } else {
  58.  
  59. echo '<div style="clear:both;float:left;height:305px">';
  60.  
  61. }
  62.  
  63. ?>
  64.  
  65. <form id="form1" name="form1" method="POST" action="modificar.php?Lotes=<?php echo $Lote; ?>">
  66.  
  67.   <table width="48%" >
  68.         <tr>
  69.           <th height="47" scope="col"><center><H2><font face="Arial, Helvetica, sans-serif">
  70.               <img src="Cuarentena.png" />&nbsp;&nbsp;&nbsp;&nbsp;CUARENTENA</font></H2></center>
  71.           </th>
  72.         </tr>
  73.   </table>
  74.  
  75.   <table width="48%">
  76.       <tr>
  77.         <th colspan="2">Material: <input name="Producto" type="text" size="35" value="<?php echo $Producto ?>  "/></th>
  78.       </tr>
  79.  
  80.       <tr>
  81.         <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>
  82.       </tr>
  83.  
  84.       <tr>
  85.         <th colspan="2">Cliente: <input name="Cliente" type="text" size="37" value="<?php echo $Cliente ?> "/></th>
  86.       </tr>
  87.  
  88.       <tr>
  89.         <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="5" value=" <?php echo $Empaque ?>"/></th>
  90.       </tr>
  91.  
  92.       <tr>
  93.         <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>
  94.       </tr>
  95.  
  96.       <tr>
  97.         <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>
  98.       </tr>
  99.  
  100.       <tr>
  101.         <th height="26" colspan="2">Observaciones: <input name="observaciones" type="text" size="28" value="   <?php echo $Observaciones ?>"/></th>
  102.       </tr>
  103.   </table>
  104.  
  105. </form>
  106.  
  107. </div>    
  108.  
  109. <form id="form1" name="form1" method="POST" action="modificar.php?Lotes=<?php echo $Lote; ?>">
  110.  
  111.           <?php
  112.  
  113.          }
  114.  
  115.          ?>
  116.  
  117. <div id="noprint">
  118.  
  119. <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>
  120.  
  121. </div>
  122.  
  123. </form>
  124.  
  125. </body>
  126.  
  127. </html>

Etiquetas: formulario
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:50.