Mantener datos en formulario despues de enviar
Publicado por Sebastian (13 intervenciones) el 02/05/2018 23:40:10
Saludos, como puedo mantener los datos en los imputs de este form después de presionar el botón enviar?
PD: lo ideal es que todo se ejecute en la misma pagina, como lo hace hasta ahora; solo que manteniendo los datos que se dijtaron despues de enviar.
este es el codigo:
PD: lo ideal es que todo se ejecute en la misma pagina, como lo hace hasta ahora; solo que manteniendo los datos que se dijtaron despues de enviar.
este es el 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<?php
//con isset evito que salga error al abrir la pagina
define("iva1", 0.19, false);
define("iva2", 1.19, false);
$valor1 = (isset($_POST['T1'])) ? $_POST['T1'] : 0;
$valor2 = (isset($_POST['T2'])) ? $_POST['T2'] : 0;
$valor3 = (isset($_POST['T3'])) ? $_POST['T3'] : 0;
$valor4 = (isset($_POST['T4'])) ? $_POST['T4'] : 0;
$porcentagedeliquidacion = (isset($_POST['T5'])) ? $_POST['T5'] : 0;
$descuentoreal = ($valor2) / 100;
$valordescuento = $valor1 * $descuentoreal;
$costo = $valor1 - $valordescuento;
$ivareal = $costo * iva1;
$precioventa = ((($costo * $porcentagedeliquidacion) + $costo) * iva2);
$precioventasiniva = $precioventa / iva2;
$calculodelcosto = $valor3 / 1.68;
$redondearpv = $valor4 / iva2;
?>
<div>
<form method="post" action="" name="editor_productos_nuevos" id="editor_productos_nuevos">
<table class="tg" border="1" id="tabla_editor_productos_nuevos" style="undefined;table-layout: fixed">
<colgroup>
<col style="width: 201px">
<col style="width: 230px">
<col style="width: 161px">
</colgroup>
<tr><!--fila 1-->
<th class="tg-031e1" colspan="3"><h3>EDITOR PRODUCTOS NUEVOS</h3></th>
</tr>
<tr><!--fila 2-->
<td class="tg-yw4l1">COSTO UNITARIO</td>
<td class="tg-yw4l1" colspan="2">RESULTADOS</td>
</tr>
<tr><!--fila 3-->
<td class="tg-031e"><input class="form-control" type="number" name="T1" id="costo" value="0" required title="Digite el costo del producto" autocomplete="off" min="0"></td>
<td class="tg-031e"><?php echo "$" . number_format($valor1, 2, ",", "."); ?></td>
<td class="tg-031e"> </td>
</tr>
<tr><!--fila 4-->
<td class="tg-yw4l"></td>
<td class="tg-yw4l2">VLR DESCUENTO= </td>
<td class="tg-yw4l"><?php echo "$" . number_format($valordescuento, 2, ",", "."); ?></td>
</tr>
<tr><!--fila 5-->
<td class="tg-yw4l1">%DESCUENTO</td>
<td class="tg-yw4l"><?php echo $valor2 . "%"; ?></td>
<td class="tg-yw4l"> </td>
</tr>
<tr><!--fila 6-->
<td class="tg-yw4l">
<input class="form-control" type="number" name="T2" id="descuento" value="0" title="Digite el descuento del producto" max="100" onFocus="if (this.value=='0') this.value='';" step="any" >
</td>
<td class="tg-yw4l2">COSTO UNITARIO TOTAL= </td>
<td class="tg-yw4l4"><?php echo "$" . number_format($costo, 2, ",", "."); ?></td>
</tr>
<tr><!--fila 7-->
<td class="tg-yw4l1">% LIQUIDACIÓN</td>
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
</tr>
<tr><!--fila 8-->
<td class="tg-yw4l"><p>
<select class="form-control" name="T5">
<option value="0.45">REPUESTOS</option>
<option value="0.22">LLANTAS 22%</option>
<option value="0.30">LLANTAS 30%</option>
</select>
</p></td>
<td class="tg-yw4l2">PRECIO VENTA= </td>
<td class="tg-yw4l3"><?php echo "$" . number_format($precioventa, 2, ",", "."); ?></td>
</tr>
<tr><!--fila 9-->
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
</tr>
<tr>
<!--fila 10-->
<td class="tg-yw4l"> </td>
<td class="tg-yw4l2">PRECIO VENTA SIN IVA= </td>
<td class="tg-yw4l3"><?php echo "($" . number_format($precioventasiniva, 2, ",", ".") . ")"; ?></td>
</tr>
<tr>
<!--fila 11-->
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
</tr>
<tr><!--fila 12-->
<td class="tg-yw4l1" colspan="3">CALCULOS INDIVIDUALES</td>
</tr>
<tr><!--fila 13-->
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
</tr>
<tr><!--fila 14-->
<td class="tg-yw4l1" colspan="3">COSTO DESDE EL PRECIO DE VENTA</td>
</tr>
<tr><!--fila 15-->
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
</tr>
<tr><!--fila 16-->
<td class="tg-yw4l1">PRECIO VENTA (/1.68)</td>
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
</tr>
<tr><!--fila 17-->
<td class="tg-yw4l"><input class="form-control" type="number" name="T3" id="costo_desde_precio_venta" title="Digite el precio de venta del producto" value="0" autocomplete="off" onFocus="if (this.value=='0') this.value='';" min="0" ></td>
<td class="tg-yw4l"><?php echo "$" . number_format($valor3, 2, ",", "."); ?></td>
<td style="background-color: rgba(240, 100, 100);" class="tg-yw4l3"><?php echo "$" . number_format($calculodelcosto, 2, ",", "."); ?></td>
</tr>
<tr><!--fila 18-->
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
</tr>
<tr><!--fila 19-->
<td class="tg-yw4l1" colspan="3">REDONDEAR PRECIO VENTA</td>
</tr>
<tr>
<td class="tg-yw4l1">PRECIO VENTA (/1.19)</td>
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
</tr>
<tr><!--fila 20-->
<td class="tg-yw4l"><input class="form-control" type="number" name="T4" value="0" title="Digite el precio de venta del producto" id="redondear_precio_venta" autocomplete="off" onFocus="if (this.value=='0') this.value='';" min="0" ></td>
<td class="tg-yw4l"><?php echo "$" . number_format($valor4, 2, ",", "."); ?></td>
<td style="background-color: rgba(62, 226, 206);" class="tg-yw4l3"><?php echo "$" . number_format($redondearpv, 2, ",", "."); ?></td>
</tr>
<tr><!--fila 21-->
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
<td class="tg-yw4l"> </td>
</tr>
<tr><!--fila 22-->
<th class="tg-031e" colspan="3" style="text-align:center;"><input class="btn btn-primary" type="submit" value="Calcular" name="B1"> </th>
</tr>
<br>
</table>
</form>
</div>
Valora esta pregunta


0