elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Tutorial básico de Quickjs


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  Crear Campos En una celda
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Crear Campos En una celda  (Leído 2,057 veces)
alexkof158


Desconectado Desconectado

Mensajes: 415


LOL


Ver Perfil
Crear Campos En una celda
« en: 3 Mayo 2012, 02:48 am »

( ! ) Notice: Undefined index: filas in C:\wamp\www\Incertidumbre\tablas.php on line 17
Código:
<body>
<h1>Modelo de Incertidumbre</h1>
<form action="tablas.php" method="POST">
Filas <input type="text" name="filas" size="3" maxlength="20" /><br />
Columnas<input type="text" name="colum" size="3" maxlength="20" /><br />
<input type="submit" value="Enviar" />
</form>
<table>
<?php
$filas = $_REQUEST['filas'];
$colum = $_REQUEST['colum'];
for($i = 0; $i< $filas; $i++){
  echo "
<tr>
";
    for($j=0; $j < $colum; $j++){
      echo "
<td> $i x $j</td>
";
    }
  echo "
</tr>
";
 }
?>
</table>
</body>
:D
Hola, apartir de haber creado la tabla siendo filas X columnas como podria hacer que me imprima un input para ingresar un dato??? :huh:

Gracias de antemano


« Última modificación: 3 Mayo 2012, 02:55 am por alexkof158 » En línea

"noproxy"
~ Yoya ~
Wiki

Desconectado Desconectado

Mensajes: 1.125



Ver Perfil
Re: Notice: Undefined index:
« Respuesta #1 en: 3 Mayo 2012, 02:56 am »

Bueno aqui el source con algunas modificaciones para evitar algunos errores...

Código
  1. <body>
  2. <h1>Modelo de Incertidumbre</h1>
  3. <form action="index.php" method="POST">
  4. Filas <input type="text" name="filas" size="3" maxlength="20" /><br />
  5. Columnas<input type="text" name="colum" size="3" maxlength="20" /><br />
  6. <input type="submit" value="Enviar" />
  7. </form>
  8. <table style="border-style: solid;">
  9. <?php
  10.  
  11. //Verifico que se hayan enviado los datos via POST
  12. //Para evitar que todo el codigo corra sin datos que provocarian error...
  13. if(!empty($_POST['filas']) && !empty($_POST['colum'])) {
  14.  
  15. $filas = $_REQUEST['filas'];
  16. $colum = $_REQUEST['colum'];
  17. for($i = 0; $i< $filas; $i++){
  18.  echo "
  19. <tr>
  20. ";
  21.    for($j=0; $j < $colum; $j++){
  22.      echo "
  23. <td style=\"border-style: solid;\"> $i x $j</td>
  24. ";
  25.    }
  26.  echo "
  27. </tr>
  28. ";
  29. }
  30.  
  31. }
  32. ?>
  33. </table>
  34. </body>

Saludos.


« Última modificación: 3 Mayo 2012, 03:06 am por ~ Yoya ~ » En línea

Mi madre me dijo que estoy destinado a ser pobre toda la vida.
Engineering is the art of balancing the benefits and drawbacks of any approach.
alexkof158


Desconectado Desconectado

Mensajes: 415


LOL


Ver Perfil
Re: Crear Campos En una celda
« Respuesta #2 en: 3 Mayo 2012, 03:10 am »

Gracias Yoya, ya me estaba leyendo que es mejor utilizar un If o Isset para evitar este tipo de errores, y Gracias
En línea

"noproxy"
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Undefined index: HTTP_MOD_REWRITE
PHP
Chazy Chaz 1 2,491 Último mensaje 15 Mayo 2012, 19:20 pm
por Chazy Chaz
Problema con mensaje de: Internet policy notice
Seguridad
Jaketwozero 2 10,100 Último mensaje 4 Abril 2013, 18:44 pm
por Jaketwozero
Notice: Undefined index: id_inv in « 1 2 »
PHP
Layla123 19 5,749 Último mensaje 13 Noviembre 2014, 20:27 pm
por Layla123
Notice: Undefined index: imagen in « 1 2 »
PHP
Layla123 19 7,935 Último mensaje 6 Enero 2015, 07:33 am
por #!drvy
Error undefined index $_POST
Desarrollo Web
SrTrp 4 2,664 Último mensaje 28 Diciembre 2017, 04:34 am
por SrTrp
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines