Agregar fila con boton y array
Publicado por abner (3 intervenciones) el 10/12/2014 10:26:42
buenas necesitaba ayuda ..
el caso es que tengo una tabla en html que quiero agregar filas con siertos valores que tengo en input tipo text el caso es que lo hice con un array y ya me agrega pero solamente una fila ayuda este es mi codigo
el caso es que tengo una tabla en html que quiero agregar filas con siertos valores que tengo en input tipo text el caso es que lo hice con un array y ya me agrega pero solamente una fila ayuda este es mi codigo
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
<?php
if (isset ($_POST ['btn1'])){
$activado = 1 ;
$unidades = $_POST["unidades"];
$Codigo = $_POST["CodProd"];
$Descripcion = $_POST["Descripcion"];
$array["Datos"]["Cantidad"]= $unidades;
$array["Datos"]["Codigo"]=$Codigo;
$array["Datos"]["Descripcion"]=$Descripcion;
$array["Datos"]["Medida"]="Post medida";
$array["Datos"]["ValUnitario"]="Post valu";
$array["Datos"]["Descuentos"]="Post des";
$array["Datos"]["Total"]="Post total";
$keys = array_keys($array["Datos"]);
$table = "<table id='tabla' border=\"1\">";
$table .= "<tr>";
foreach($keys as $i){
$table .= "<th>".$i."</th>";
}
$table .="</tr>";
foreach($keys as $i){
$table .= "<td>".$array["Datos"]["${i}"]."</td>";
}
$table .= "</table>";
echo $table ;
}
?>
Valora esta pregunta
0