Ya lo solucione
con sesiones lo hice de esta forma no se si sea la mejor forma pero me funciono
Código HTML:
Ver original<form action="" method="post"> <input type="text" name="codigo" /> <input type="text" name="producto" /> <input type="text" name="cantidad" /> <input type="text" name="descripcion" /> <input type="text" name="precioU" /> <input type="submit" name="procesar" />
Código PHP:
Ver original<?php
if(isset($_POST["procesar"])) {
if(!isset($_SESSION["pedido"])) {
$pedido = $_SESSION["pedido"];
$pedido[$_POST["codigo"]] = array ( "codigo"=>$_POST["codigo"],
"producto"=>$_POST["producto"],
"cantidad"=>$_POST["cantidad"],
"descripcion"=>$_POST["descripcion"],
"precioU"=>$_POST["precioU"]
);
$_SESSION["pedido"] = $pedido;
}
else
{
@$pedido = $_SESSION["pedido"];
$pedido[$_POST["codigo"]] = array ( "codigo"=>$_POST["codigo"],
"producto"=>$_POST["producto"],
"cantidad"=>$_POST["cantidad"],
"descripcion"=>$_POST["descripcion"],
"precioU"=>$_POST["precioU"]
);
$_SESSION["pedido"] = $pedido;
}
$total = 0;
$subtotal = 0;
?>
<table border="1" width="700">
<tr>
<th>Codigo</th>
<th>Producto o servicio</th>
<th>Cantidad</th>
<th>Descripcion</th>
<th>$ Precio U.</th>
<th>$ Importe</th>
</tr>
<?php
foreach($_SESSION["pedido"] as $servicio)
{ $subtotal = $servicio["precioU"] * $servicio["cantidad"]; ?>
<tr>
<td><?php echo $servicio["codigo"]; ?></td>
<td><?php echo $servicio["producto"]; ?></td>
<td><?php echo $servicio["cantidad"]; ?></td>
<td><?php echo $servicio["descripcion"]; ?></td>
<td><?php echo $servicio["precioU"]; ?></td>
<td><?php echo $subtotal; ?></td>
</tr>
<?php
}
echo "</table>";
}
?>
y con eso ya me imprime la tabla con los datos de cada arreglo de cada indice y en el var_dump me imprime lo que yo decia
Código PHP:
Ver original '001' =>
'codigo' => string '001' (length=3)
'producto' => string 'tarjetas' (length=8)
'cantidad' => string '500' (length=3)
'descripcion' => string 'tarjetas' (length=8)
'precioU' => string '1.20' (length=4)
'002' =>
'codigo' => string '002' (length=3)
'producto' => string 'folletos' (length=8)
'cantidad' => string '1000' (length=4)
'descripcion' => string 'folletos' (length=8)
'precioU' => string '50.00' (length=5)
'003' =>
'codigo' => string '003' (length=3)
'producto' => string 'banderas' (length=8)
'cantidad' => string '500' (length=3)
'descripcion' => string 'banderas' (length=8)
'precioU' => string '100' (length=3)
'004' =>
'codigo' => string '004' (length=3)
'producto' => string 'planos' (length=6)
'cantidad' => string '100' (length=3)
'descripcion' => string 'planos' (length=6)
'precioU' => string '50' (length=2)
gracias por el apoyo de todas formas y pateketrueke no te molestes soy novato en esta onda de arreglos y si lei el manual pero no comprendi por eso segui pidiendo apoyo