Resulta que hice un formulario, en el que ingreso la cantidad de ítems que voy a vender. Cuando procesa, muestra la cantidad de campos solicitada.
El tema es que luego tengo que procesar este último formulario, y no sé cómo pasar los nombres de los inputs (que se llaman nombre1, nombre2, nombre3 y así).
Quizá alguien pueda ayudarme, creo que es fácil para los expertos, yo estoy medio perdido:
Código:
if ($cantidad_rep=="")
{
?>
<form action="vender.php" method="post" enctype="multipart/form-data" name="form1">
<input type="hidden" name="que" value="repuesto"/>
Indique la cantidad de ítems diferentes que venderá en la operación:
<input type="text" name="cantidad_rep" />
<input type="submit" name="Submito" value="Enviar">
</form>
<?php
}
else
{
if ($Submit=="")
{
?>
<form action="vender.php" method="post" enctype="multipart/form-data" name="form1">
<input type="hidden" name="cantidad_rep" value="<?php echo $cantidad_rep; ?>"/>
<p class="negrita">Vender repuesto </p>
<table width="400%" border="0">
<tr>
<td>Cantidad</td>
<td>Precio unitario</td>
<td>Repuesto</td>
</tr>
<?php
for ($i=1; $i <= $cantidad_rep; $i++)
{
?>
<tr>
<td><input name="cantidad<?php echo $i; ?>" type="text" id="cantidad" value="1" size="4" /></td>
<td>$ <input name="importe<?php echo $i; ?>" type="text" id="importe" size="6" /></td>
<td><select name="repuesto<?php echo $i; ?>" id="repuesto">
<? require ("requires/repuestos.php"); ?>
</select></td>
</tr>
<?php
}
?>
</table>
</form>
<?
}
else
{
for ($i=1; $i <= $cantidad_rep; $i++)
{
$result = mysql_query("SELECT * from luga_repuestos where id_repuesto='$repuesto$i'", $conexion);
while ($row=mysql_fetch_array($result)){
$costo[$i]=$row['precio'];
}
/*TOMA EL NOMBRE DEL REPUESTO COMO REPUM*/
$sql22a = "SELECT * FROM luga_listarepuestos WHERE id = '$repuesto$i'";
$result22a = mysql_query($sql22a, $conexion);
if ($row = mysql_fetch_array($result22a)){
mysql_field_seek($result22a,0);
do {
$repum[$i]="$cantidad$i ".$row['modelo']." (".$row['descripcion'].")";
}
while ($row = mysql_fetch_array($result22a));
}
$importe[$i]=($importe[$i]*$cantidad[$i]);
}
el tema está en los arrays que inventé $importe[$i] y otros por el estilo...
alguna ayuda?
Gracias!