
Recuperar datos complejos enviados con GET
Publicado por Carlos (1 intervención) el 07/03/2022 14:51:10
Saludos, un poco de ayuda por favor.
Envio datos de un formulario y recibo en el url lo siguiente
Alli se encuentran los datos que requiero, un id y una cantidad de varios productos, pero no se como manejarlos de manera individual.
esto es el formulario de origen
esto es una impresion con var_dump de los recibido
De aqui requiero el numero seguido del id_ y la cantidad asociada a cada id_
gracias
Envio datos de un formulario y recibo en el url lo siguiente
1
http://localhost/lacarniceria/_admin/compra_add2.php?id_22=Lomo&Cantidad%5B%5D=10&id_23=Paleta&Cantidad%5B%5D=20&id_24=Pernil&Cantidad%5B%5D=30&total=60&Aceptar=Aceptar
esto es el formulario de origen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<form action="compra_add2.php" method="get" name="form_compra">
<table width="100%" border="1">
<tr>
<td>Codigo:</td>
<td>Tipo:</td>
<td>Nombre:</td>
<td>Clase:</td>
<td>Unidad:</td>
<td>Existencia:</td>
<td>Cantidad Comprada:</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_ProdutosLista['id_Producto']; ?></td>
<td><?php echo $row_ProdutosLista['Tipo']; ?></td>
<td><?php echo $row_ProdutosLista['N_Producto']; ?></td>
<td><?php echo $row_ProdutosLista['Clase']; ?></td>
<td><?php echo $row_ProdutosLista['Unidad']; ?></td>
<td><?php echo $row_ProdutosLista['stock']; ?></td>
<input type="hidden" name="id_<?php echo $row_ProdutosLista['id_Producto']; ?>" value="<?php echo $row_ProdutosLista['N_Producto']; ?>" >
<td><input type="text" name="Cantidad[]" value="" ></td>
</tr>
<?php } while ($row_ProdutosLista = mysql_fetch_assoc($ProdutosLista)); ?>
</table>
<br>
<table width="100%" border="1">
<tr>
<td width="75%">Costo total de la compra.</td>
<td><input type="text" name="total"></td>
</tr>
</table>
<input type="submit" value="Aceptar" name="Aceptar">
</form>
esto es una impresion con var_dump de los recibido
1
array(6) { ["id_22"]=> string(4) "Lomo" ["Cantidad"]=> array(3) { [0]=> string(2) "10" [1]=> string(2) "20" [2]=> string(2) "30" } ["id_23"]=> string(6) "Paleta" ["id_24"]=> string(6) "Pernil" ["total"]=> string(2) "60" ["Aceptar"]=> string(7) "Aceptar" }
gracias
Valora esta pregunta


0