PHP - Ayuda!! 2 formularios en una misma pagina

 
Vista:
sin imagen de perfil

Ayuda!! 2 formularios en una misma pagina

Publicado por krlos (5 intervenciones) el 02/09/2016 20:50:01
En esta pagina tengo 2 formularios, uno debe enviar los datos a la tabla factura que es control.php y el otro debe enviar los datos a la tabla detalle_factura que es control2.php y no se como hacerlo, ademas me gustaría hacerlo utilizando 1 botón; soy novato en programación, ojala me puedan ayudar o dar una posible solución, muchas gracias

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
<html>
<head>
<title>Facturacion</title>
</head>
<body>
<form action="Control.php" name="Registro_Factura" id="Registro_Factura" method="post">
<table width="428" border="0" align="center">
  <tr>
    <td width="110">Factura</td>
    <td width="308">
<input type="text" name="IdFactura" id="IdFactura" size="6" onChange="asignar()"></td>
  </tr>
  <tr>
    <td>Fecha</td>
    <td>
<input type="date" name="Fecha" id="Fecha" size="13" value="" readonly></td>
  </tr>
  <tr>
    <td>#Guia</td>
    <td><input type="text" name="Guia" id="Guia"  size="15"/></td>
  </tr>
  <tr>
    <td>Cliente</td>
<td><input type="text" name="Cliente" id="Cliente"  size="15"/></td>
   </tr>
  <tr>
    <td>Cedula</td>
    <td><input type="text" name="Cliente_Cedula" id="Cliente_Cedula"  size="6" readonly></td>
  </tr>
  </tr>
  <tr>
    <td>Vendedor</td>
<td><input type="text" name="Vendedor" id="Vendedor"  size="6" readonly></td>
    </tr>
  <tr>
    <td>Ced Vende</td>
    <td><input type="text" name="Vendedor_Cedula" id="Vendedor_Cedula"  size="6" readonly></td>
  </tr>
  <tr>
    <td>Tipo de Venta </td>
    <td>
 <select name="TipoVenta" id="TipoVenta" style="width:120px">
   <option>Credito</option>
 <option>Contado</option>
  </select> </td>
  </tr>
  <tr>
    <td>Observacion</td>
    <td>
      <textarea name="Observacion" id="Observacion" style="width:120px"></textarea> </td>
  </tr>
  <tr>
    <td>Total</td>
    <td><input type="text" name="Total" id="Total"  size="6"></td>
  </tr>
  <tr>
    <td>Pago Total </td>
    <td><input type="text" name="Pago_Total" id="Pago_Total"  size="6"></td>
  </tr>
  <tr>
    <td>
</td>
  </tr>
  </table>
<form action="Control2.php" name="Registro_Producto" id="Registro_Producto" method="post">
<table width="200" border="0" align="center">
  <tr>
    <td>Factura</td>
    <td>Fecha</td>
    <td>Productos</td>
    <td>Valor</td>
    <td>Cantidad</td>
    <td>Imeis</td>
    <td>Subtotal</td>
    <td>Bodega</td>
  </tr>
  <tr>
    <td><input type="text" name="Fecha" id="Fecha"  size="15"/></td>
    <td>
      <select name="Productos" id="Productos" style="width:120px">
 <option>Alcatel</option>
 <option>Huawei</option>
 <option>Samsung</option>
      </select>
    </td>
    <td><input type="text" name="idFactura_Factura" id="Valor"  size="15"/></td>
    <td><input type="text" name="Valor" id="Valor"  size="15"/></td>
    <td><input type="text" name="Cantidad" id="Cantidad"  size="15"/></td>
    <td><input type="text" name="Imeis" id="Imeis"  size="15"/></td>
    <td><input type="text" name="Subtotal" id="Subtotal"  size="15"/></td>
    <td>
      <select name="select" style="width:120px">
 <option>Local 1</option>
 <option>Local 2</option>
 <option>Local 3</option>
      </select>
</td>
  </tr>
    <tr>
    <td colspan="11" align="center" id="botones"><input type="submit" name="Enviar" value="Enviar">      <input type="reset" name="Borrar" value="Borrar"></td>
  </tr>
</table>
</form>
</form>
</body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Ayuda!! 2 formularios en una misma pagina

Publicado por xve (6935 intervenciones) el 03/09/2016 11:01:22
Hola krlos, la verdad es que no hay una buena solución a nos ser que utilices ajax...

Anteriormente, podias hacer algo como:
1
2
3
4
5
6
7
8
<input type="button" name="Enviar" value="Enviar" onclick="enviarDosFormularios()">
<script>
function enviarDosFormularios()
{
	document.getElementById("Registro_Factura").submit();
	document.getElementById("Registro_Producto").submit();
}
</script>

pero últimamente, en muchos navegadores no funciona... yo te recomiendo que utilices AJAX!!!

Mírate este ejemplo:
http://www.lawebdelprogramador.com/codigo/JQuery/3473-Enviar-desde-jquery-parametros-por-POST.html
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
sin imagen de perfil

Ayuda!! 2 formularios en una misma pagina

Publicado por Carlos (5 intervenciones) el 03/09/2016 23:16:16
Muchas gracias, voy a probar
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar