PHP - ¿Como capturar datos de option en php para ser enviado por mail?

 
Vista:
sin imagen de perfil

¿Como capturar datos de option en php para ser enviado por mail?

Publicado por arturo (2 intervenciones) el 05/08/2014 18:57:59
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<FORM method= POST action="mail.php" >
<ENCTYPE="TEXT/PLAIN">
Formulario de Eventos Adversos
 
 
<script type="text/javascript">
var seleccion = null;
var forma= [null, 'Farmacia', 'Dental', 'Procedimiento', 'Transporte', 'Vacunatorio','Atencion de la Mujer','Cirujia Menor','Kinesiologia y Rehabilitación'];
function muestra(formulario) {
if (seleccion != null)
document.getElementById(seleccion).style.display = 'none';
if (forma[formulario] != null)
document.getElementById(forma[formulario]).style. display = 'block';
seleccion = forma[formulario]
}
</script>
<body>
 
<html>
<title> Formularios</title>
<BR><BR><ENCTYPE="TEXT/PLAIN">
Seleccione Tipo de Evento
<BR>
<BR><INPUT TYPE="radio" NAME="TipoDeEvento" VALUE="Adverso" CHECKED>Adverso
<INPUT TYPE="radio" NAME="TipoDeEvento" VALUE="Centinela" CHECKED>Centinela
<BR><BR>
</form>
 
<form  >
 
Seleccione
 
&nbsp;<select name="unidad" onchange="muestra(this.selectedIndex)">
 
<option value="0">Seleccione Unidad</option>
<option value="1">Farmacia</option>
<option value="2">Dental</option>
<option value="3">Procedimiento</option>
<option value="4">Transporte</option>
<option value="5">Vacunatorio</option>
<option value="6">Atencion de la Mujer</option>
<option value="7">Cirujia Menor</option>
<option value="8">Kinesiologia y Rehabilitación </option>
</select>
 
 
</form>
 
<form action="" method="post" name="form1" id="Farmacia" style="display:none;">
Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="uno">
<option value="0">Seleccione Opcion</option>
<option value="1">Prescripcion</option>
<option value="2">Preparacion</option>
<option value="3">Transcripción</option>
<option value="4">Entrega</option>
</select>
</form>
 
<form id="Dental" name="form1" method="post" action="" style="display:none;">
Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="uno">
<option value="0">Seleccione Opcion</option>
<option value="1">Administracion</option>
<option value="2">Prescripción</option>
</select>
</form>
 
<form id="Procedimiento" name="form1" method="post" action="" style="display:none;">
Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="uno">
<option value="0">Seleccione Opcion</option>
<option value="1">Procedimiento</option>
</select>
</form>
 
<form id="Transporte" name="form1" method="post" action="" style="display:none;">
Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="uno">
<option value="0">Seleccione Opcion</option>
<option value="1">Caida de Camilla</option>
</select>
</form>
 
 
 
 
<form id="Transporte" name="form1" method="post" action="" style="display:none;">
Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="uno">
<option value="0">Seleccione Opcion</option>
<option value="1">Caida de Camilla</option>
</select>
</form>
 
<form id="Vacunatorio" name="form1" method="post" action="" style="display:none;">
Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="uno">
<option value="0">Seleccione Opcion</option>
<option value="1">Registro Erroneo</option>
<option value="2">Adm. Vacuna equivocada</option>
<option value="3">Registro Incompleto e Inexistente</option>
 
</select>
</form>
 
<form id="Atencion de la Mujer" name="form1" method="post" action="" style="display:none;">
Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="uno">
<option value="0">Seleccione Opcion</option>
<option value="1">Papanicolau</option>
</select>
</form>
 
<form id="Cirujia Menor" name="form1" method="post" action="" style="display:none;">
Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="uno">
<option value="0">Seleccione Opcion</option>
<option value="1">Biopsia</option>
</select>
</form>
 
<form id="Kinesiologia y Rehabilitación" name="form1" method="post" action="" style="display:none;">
Item&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select name="uno">
<option value="0">Seleccione Opcion</option>
<option value="1">Caida</option>
</select>
</form>
 
<BR>
Ingrese Fecha de Evento
<input name="fecha"type="date">
<BR><BR>
Hora Aproximada del Evento
<input name="hora" type="time">
<BR><BR><BR>
 
<ENCTYPE="TEXT/PLAIN">
 
<label for="mensaje">Descripción:  </label><br/>
		<textarea cols="25" rows="10" name="mensaje" id="mensaje"></textarea><br />
 
 
<P> <input type="submit" value="Enviar" />
<INPUT TYPE="reset" VALUE="Borrar datos">
 
</FORM>
 
 
 
</html>
 
 
// en php
<?
$para= "sumail@gmail.com";
$TipoDeEvento="\n".$_POST['TipoDeEvento'];
$asunto="Mensaje de Evento" ;
$destino=$_POST['destino'];
$selecciona =$_POST['unidad'];
 
$item=$_POST['form1'];
$hora=$_POST['hora'];
$fecha=date("d-m-Y");
$mensaje=$_POST["mensaje"];
 
 
 $mensaje= "
 Tipo de Evento: $TipoDeEvento <br />
 Unidad: $selecciona <br />
 Item: $item <br />
 Hora Evento: $hora <br />
Fecha Evento:$fecha<br /><br />
 Descripcion: $mensaje <br />";
 
 
 
 $headers = "MIME-VERSION:1.0\r\n";
 $headers .= "Content-Type: text/html;\r\n charset=iso-8859-1; \r\n";
 
 
 if (mail($para, $asunto,  $mensaje,$headers))
 	echo("mensaje correctamente enviado");
else
        echo("mensaje no enviado");
?>
ayuda porfa
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

¿Como capturar datos de option en php para ser enviado por mail?

Publicado por xve (6935 intervenciones) el 05/08/2014 21:19:33
Hola Arturo, tienes un montón de formularios <form>... solo te enviara los datos del formulario donde se encuentre el botón... utiliza un solo formulario.
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
sin imagen de perfil

¿Como capturar datos de option en php para ser enviado por mail?

Publicado por arturo (2 intervenciones) el 05/08/2014 21:30:13
Gracias por responder..
Efectivamente tenia muchos <form>..
el problema es que ahora que se los saque no me depliega el cuadro con los sub opciones y el dato que se captura y muestra es el valor del value
ejemplo:
Tipo de Evento: Centinela
Unidad: 1 //aqui deberia decir farmacia
Item:
Hora Evento: 00:58
Fecha Evento:05-08-2014
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