![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
12/04/2007, 02:56
|
![Avatar de Shevkorn](http://static.forosdelweb.com/customavatars/avatar86014_2.gif) | | | Fecha de Ingreso: enero-2005 Ubicación: Trujillo
Mensajes: 34
Antigüedad: 20 años Puntos: 1 | |
Re: Manejo De Array De Cajas De Texto¡¡¡¡+ Php Hola, puedes hacer algo sencillo y a ver si te sirve un poco lo q te voy a decir, presta atencion:
En esta parte de tu código la estas barriendo con un ciclo FOR
for ($i=1;$i<=$txtNroProductos;$i++)
{?>
<tr>
<td height="22" width="20" bordercolordark="#454560"><input type="text" size="10" name="txtidArticulo[]">
</td>
<td height="22"><input type="text" name="txtdescArticulo[]">
<? // <input type="submit" name="btnAyuda" value=" " onClick="<? $NUMERO=$txtdescArticulo[$i];?>
<? // echo "<td><a href=\"ayudaDescripCP.php ?descripcion=".$txtdescArticulo[$i]."\">Ayuda</a></td>";
echo "<td><a href=\"ayudaDescripCP.php ?numero=".$txtdescArticulo[$i]."\">Ayuda</a></td>";
?>
</td>
<td height="22" width="20"><input type="text" size="10" name="txtvccArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtcantArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtprecioArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtimpuestoArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txtimporteArticulo[]"></td>
<td height="22" width="20"><input type="text" size="10" name="txttotalArticulo[]"></td>
</tr>
<?
}
Ahora mi sugerencia esta q en lugar de corchetes, concatenes el ciclo con la variable. Por ejemplo:
<input type="text" size="10" name="txtidArticulo<?php echo $i?>">
y asi para todos los demas seudoarrays q tienes.
Ahora, para recuperarlos, lo haces de la misma forma e inclusive lo puedes meter a un array para hacerlo mas sencillo de volcarlo en la bd
for($i=1;$i<cantidad;$i++)
{
$resultados[$i]=$_POST['txtidArticulo'.$i]; //en caso usaras get le cambias
}
luego haces lo q se te de la gana con la matriz.
Te recomiendo q pongas form y q tambien le pongas el método necesariamente.
Saludos y espero haberte ayudado en algo.
__________________ Taek said: ¿Aùn los pecadores podremos llegar al cielo? |