
Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/...
Publicado por Bladimir (88 intervenciones) el 05/04/2015 18:51:20
Hola a todos. Tengo un archivo php el cual , al hacer click en un boton debe dirigirme a otra pagina pero no lo hacee sino que produce el siguiente mensaje: Cannot modify header information - headers already sent by (output started at /opt/lampp/htdocs/RHM/Crearpx.php:187) in /opt/lampp/htdocs/RHM/Crearpx.php on line 196. Por lo que he leido es un error frecuente pero de multiples causas lo que me ha impedido descubrir la causa de la falla. Alguna ayuda sera aparecida. El codigo completo es le siguiente:
Al dar click en el buton aparece el mensaje de error ya señalado.
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>RHM</title>
<script type="text/javascript">
function comprobar() {
var nombre = document.elegir.nombre;
var apellido = document.elegir.apellido;
var aviso = document.getElementById("aviso");
aviso.innerHTML = ""
var enviar = "si"
if ((nombre.value == "" || nombre.value.indexOf(" ") == 0) || (apellido.value == "" || apellido.value.indexOf(" ") == 0 ) || (cedula.value == "" || cedula.value.indexOf(" ") == 0 ) || (dianac.value == "" || dianac.value.indexOf(" ") == 0 ) || (mesnac.value == "" || mesnac.value.indexOf(" ") == 0 ) || (anonac.value == "" || anonac.value.indexOf(" ") == 0 ) || (monto.value == "" || monto.value.indexOf(" ") == 0 )){
var adver = "1"
hola = document.getElementById("prueba");
hola.value = adver;
enviar = "no"
}
if (enviar == "no") {return false}
}
function restaurar() {
var adver = ""
hola = document.getElementById("prueba");
hola.value = adver;
}
</script>
<script type="text/javascript">
function escribe() {
fechaHoy = new Date();
annoActual = fechaHoy.getFullYear();
mesActual = fechaHoy.getMonth()+1;
diaActual = fechaHoy.getDate();
escribir = document.getElementById("edad")
Dianac = document.elegir.dianac.value
Mesnac = document.elegir.mesnac.value
Anonac = document.elegir.anonac.value
var Edad = annoActual-Anonac;
if(mesActual<Mesnac){
Edad--;
}
if(mesActual==Mesnac){
if(Dianac<diaActual){
Edad--;
}
}
texto = document.getElementById("edad");
texto.value = Edad;
}
window.onload = function(){
fecha = new Date();
texto = document.getElementById("fechaing");
texto.value = fecha.getDate() + "/" + (fecha.getMonth() + 1) + "/" + fecha.getFullYear();
genero();
letra();
financia();
clinic()
}
</script>
</head>
<script type="text/javascript">
function startTime(){
today = new Date;
h=today.getHours();
}
</script>
<body>
<form name="elegir" action="#" method="post" onsubmit="return comprobar()">
<script type="text/javascript">
function letra() {
lista = document.elegir.concepto;
elegido = lista.selectedIndex;
opcion = lista.options[elegido];
Concepto = opcion.value;
texto = opcion.text;
document.body.style.fontFamily = concepto;
escribe = document.getElementById("texto");
escribe.value = texto;
}
</script>
<script type="text/javascript">
function genero() {
lista = document.elegir.sexog;
elegido = lista.selectedIndex;
opcion = lista.options[elegido];
Concepto = opcion.value;
sexo = opcion.text;
document.body.style.fontFamily = sexog;
escribe = document.getElementById("sexo");
escribe.innerHTML = sexo;
escribe.value = sexo;
}
</script>
<script type="text/javascript">
function financia() {
lista = document.elegir.financ;
elegido = lista.selectedIndex;
opcion = lista.options[elegido];
Concepto = opcion.value;
pago = opcion.text;
document.body.style.fontFamily = Concepto;
escribe = document.getElementById("pago");
escribe.value = pago;
}
</script>
<script type="text/javascript">
function clinic() {
lista = document.elegir.clinica;
elegido = lista.selectedIndex;
opcion = lista.options[elegido];
Concepto = opcion.value;
centro = opcion.text;
document.body.style.fontFamily = Concepto;
escribe = document.getElementById("centro");
escribe.value = centro;
}
</script>
<fieldset>
<legend>
<b> Datos de paciente: </b>
</legend>
<p> <b>Nombre:</b> <input type="text" name="nombre" id="nombre" onfocus="restaurar()"/>
<b>Apellido: </b><input type="text" name="apellido" id="apellido" onfocus="restaurar()"/>
CI:</b> <input type="text" name="cedula" id="cedula" onfocus="restaurar()"/></p>
<p> <b>Fecha de nacimiento:</b>
<input type="date" name="dianac" onfocus="restaurar()" id="dianac" maxlength="2" style="width:20px;height:20px;background-color:white;color:black;font-size:12pt; font-family:Verdana;text-align:center;" >
<input type="date" name="mesnac" onfocus="restaurar()" id="mesnac" maxlength="2" style="width:20px;height:20px;background-color:white;color:black;font-size:12pt; font-family:Verdana;text-align:center;">
<input type="date" name="anonac" onfocus="restaurar()" id="anonac" maxlength="4" style="width:40px;height:20px;background-color:white;color:black;font-size:12pt; font-family:Verdana;text-align:center;">
<b>Edad:</b> <input type="text" name="edad" id="edad"/>
<b>Sexo:</b>
<select name="sexog" id="sexog" onclick="genero()">
<option value="Masculino">Masculino</option>
<option value="Femenino">Femenino</option>
</select>
</p>
<p> <b>Fecha de Ingreso: </b><input type="date" id="fechaing">
<b>Concepto:</b>
<select name="concepto" id="concepto" onclick="letra()">
<option value="Consulta">Consulta</option>
<option value="ECVPO">ECVPO</option>
</select>
<b>Financiamiento:</b>
<select name="financ" id="financ" onclick="financia()">
<option value="Particular">Particular</option>
<option value="IPSPUNEG">IPSPUNEG</option>
</select>
</p>
<p> <b>Monto:</b> <input type="text" name="monto" onfocus="restaurar()" id="monto" onclick="escribe()"/>
<b>Telefono:</b> <input type="text" name="telefono" id="telefono"/>
<b>Clinica:</b>
<select name="clinica" id="clinica" onclick="clinic()" >
<option value="HospClinCar">Hospital de Clinicas Caroni</option>
<option value="PrimeroMayo">Clinica Primero de mayo</option>
</select>
</p>
</fieldset>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p></p>
<p>
<a href=Consulta.php> Generar consulta </a>
<a href=Decidir.php> Ir a inicio</a>
<a href=ECVPO.php> Generar ECVPO</a>
</p>
<p>
<b><input name="sex" type="text" id="sexo"</b>
<b><input name="tex" type="text" id="texto"</b>
<b><input name="finan" type="text" id="pago"</b>
<b><input name="centr" type="text" id="centro"</b>
</b> <input name="prueba" type="text" id="prueba"/>
<p><input name="ver" id="ver" type="submit" value="ver"/>
</p>
<b><input name="centr" type="text" id="centro"</b>
<?php
$nombr=$_POST['nombre'];
$apellid=$_POST['apellido'];
$cedul=$_POST['cedula'];
$dia=$_POST['dianac'];
$mes=$_POST['mesnac'];
$anno=$_POST['anonac'];
$mont=$_POST['monto'];
if (strlen($nombr)>1) {
header("Location: Decidir.php, TRUE,301");
}
?>
</form>
</body>
</html>
Al dar click en el buton aparece el mensaje de error ya señalado.
Valora esta pregunta


0