Comunidad de diseño web y desarrollo en internet online

que me sale mal if else ayuda

Citar            
MensajeEscrito el 21 Abr 2011 07:43 pm
hola soy relativamente nuevo en php

y tengo este escript no se como hacerlo me podrian ayudar

<?php

$palabra = $_POST['palabra'];

if ($palabra == 'Absolutos de la Calidad') {
header('Location: quienes_somos.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Catorce Pasos de Crosby') {
header('Location: quienes_somos.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Hoja de Modelo de Procesos') {
header('Location: quienes_somos.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Colegio de la Calidad') {
header('Location: quienes_somos.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Alexander Gage') {
header('Location: quienes_somos.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Javier Cruz Campos') {
header('Location: quienes_somos.php');
}
else {
echo 'Gladys Penagos Flores';
}

if ($palabra == 'Roberto Rodríguez') {
header('Location: quienes_somos.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Director General') {
header('Location: quienes_somos.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Consultor Senior') {
header('Location: quienes_somos.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Alexandro Gage') {
header('Location: quienes_somos.php');
}
else {
echo 'cajazul2.html';
}


if ($palabra == 'Director de Proyectos') {
header('Location: quienes_somos.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Cursos y Talleres') {
header('Location: cursos_talleres.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Medición') {
header('Location: cursos_talleres.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Costo de la Calidad') {
header('Location: cursos_talleres.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Diagnóstico del costo de la Calidad') {
header('Location: cursos_talleres.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Auditorias ISO 9000') {
header('Location: cursos_talleres.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Auditorias Operativas') {
header('Location: cursos_talleres.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Modelos') {
header('Location: cursos_talleres.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Proveedores') {
header('Location: cursos_talleres.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Control Estadístico de Procesos') {
header('Location: cursos_talleres.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Herramientas') {
header('Location: cursos_talleres.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Servicios') {
header('Location: servicios.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Diagnóstico') {
header('Location: servicios.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Educación') {
header('Location: servicios.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Implantación') {
header('Location: servicios.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Servicios Especiales') {
header('Location: servicios.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Gestión de la Calidad') {
header('Location: servicios.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Gestión de la Rentabilidad') {
header('Location: servicios.php');
}
else {
echo 'cajazul2.html';
}


if ($palabra == 'Clientes') {
header('Location: clientes.php');
}
else {
echo 'cajazul2.html';
}

if ($palabra == 'Contacto') {
header('Location: contacto.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Preguntas') {
header('Location: faqs.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'FaQs') {
header('Location: faqs.php');
}
else {
echo 'cajazul2.html';
}
if ($palabra == 'Registro') {
header('Location: registro.php');
}
else {
echo 'cajazul2.html';
}
?>

Por kanzer

11 de clabLevel



 

firefox
Citar            
MensajeEscrito el 21 Abr 2011 10:28 pm
Bueno, no vas tan mal encaminado, al parecer lo que quieres es incluir paginas php dependiendo del if, en ese caso, en primer lugar te recomiendo que para que sea más ordenado lo uses con la sentencia case, y para incluir una pagina no uses echo, porque lo que hace echo es escribir una cadena de texto, debes hacer include, de la siguiente forma:
por ejemplo:

switch($palabra){


case 'Registro' :include('cajaazul2.html');
case default : include('cajazul2.html');

}



y te recomiendo que uses en tus archivos extensión php, por mantener el orden más que nada

(ya que estas programando en php xD), saludos y suerte

Por sebifrost

61 de clabLevel



 

firefox
Citar            
MensajeEscrito el 22 Abr 2011 12:09 am
asi esta mejor?

Código PHP :

<?php

$palabra = $_POST['palabra'];

switch($palabra){

case 'Absolutos de la Calidad' :include('Location: quienes_somos.php');

case 'Catorce Pasos de Crosby' :include('Location: quienes_somos.php');

case 'Hoja de Modelo de Procesos' :include('Location: quienes_somos.php');

case 'Colegio de la Calidad' :include('Location: quienes_somos.php');

case 'Alexander Gage' :include('Location: quienes_somos.php');

case 'Javier Cruz Campos' :include('Location: quienes_somos.php');

case 'Roberto Rodríguez' :include('Location: quienes_somos.php');

case 'Director General' :include('Location: quienes_somos.php');

case 'Consultor Senior' :include('Location: quienes_somos.php');

case 'Alexandro Gage' :include('Location: quienes_somos.php');

case 'Director de Proyectos' :include('Location: quienes_somos.php');

case 'Cursos y Talleres' :include('Location: cursos_talleres.php');

case 'Medición' :include('Location: cursos_talleres.php');

case 'Costo de la Calidad' :include('Location: cursos_talleres.php');

case 'Diagnóstico del costo de la Calidad' :include('Location: cursos_talleres.php');

case 'Auditorias ISO 9000' :include('Location: cursos_talleres.php');

case 'Auditorias Operativas' :include('Location: cursos_talleres.php');

case 'Modelos' :include('Location: cursos_talleres.php');

case 'Proveedores' :include('Location: cursos_talleres.php');

case 'Control Estadístico de Procesos' :include('Location: cursos_talleres.php');

case 'Herramientas' :include('Location: cursos_talleres.php');

case 'Servicios' :include('Location: servicios.php');

case 'Diagnóstico' :include('Location: servicios.php');

case 'Educación' :include('Location: servicios.php');

case 'Implantación' :include('Location: servicios.php');

case 'Servicios Especiales' :include('Location: servicios.php');

case 'Gestión de la Calidad' :include('Location: servicios.php');

case 'Gestión de la Rentabilidad' :include('Location: servicios.php');

case 'Clientes' :include('Location: clientes.php');

case 'Contacto' :include('Location: contacto.php');

case 'Preguntas' :include('Location: faqs.php');

case 'FaQs' :include('Location: faqs.php');

case 'Registro' :include('Location: registro.php');

}

?>

Por kanzer

11 de clabLevel



 

firefox
Citar            
MensajeEscrito el 22 Abr 2011 12:17 am
disculpen puse lo anterior y me sale lo sig

Código PHP :

Warning: include(Location: quienes_somos.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 7

Warning: include() [function.include]: Failed opening 'Location: quienes_somos.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 7

Warning: include(Location: quienes_somos.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 9

Warning: include() [function.include]: Failed opening 'Location: quienes_somos.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 9

Warning: include(Location: quienes_somos.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 11

Warning: include() [function.include]: Failed opening 'Location: quienes_somos.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 11

Warning: include(Location: quienes_somos.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 13

Warning: include() [function.include]: Failed opening 'Location: quienes_somos.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 13

Warning: include(Location: quienes_somos.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 15

Warning: include() [function.include]: Failed opening 'Location: quienes_somos.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 15

Warning: include(Location: quienes_somos.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 17

Warning: include() [function.include]: Failed opening 'Location: quienes_somos.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 17

Warning: include(Location: quienes_somos.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 19

Warning: include() [function.include]: Failed opening 'Location: quienes_somos.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 19

Warning: include(Location: quienes_somos.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 21

Warning: include() [function.include]: Failed opening 'Location: quienes_somos.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 21

Warning: include(Location: quienes_somos.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 23

Warning: include() [function.include]: Failed opening 'Location: quienes_somos.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 23

Warning: include(Location: quienes_somos.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 25

Warning: include() [function.include]: Failed opening 'Location: quienes_somos.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 25

Warning: include(Location: quienes_somos.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 27

Warning: include() [function.include]: Failed opening 'Location: quienes_somos.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 27

Warning: include(Location: cursos_talleres.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 29

Warning: include() [function.include]: Failed opening 'Location: cursos_talleres.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 29

Warning: include(Location: cursos_talleres.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 31

Warning: include() [function.include]: Failed opening 'Location: cursos_talleres.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 31

Warning: include(Location: cursos_talleres.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 33

Warning: include() [function.include]: Failed opening 'Location: cursos_talleres.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 33

Warning: include(Location: cursos_talleres.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 35

Warning: include() [function.include]: Failed opening 'Location: cursos_talleres.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 35

Warning: include(Location: cursos_talleres.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 37

Warning: include() [function.include]: Failed opening 'Location: cursos_talleres.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 37

Warning: include(Location: cursos_talleres.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 39

Warning: include() [function.include]: Failed opening 'Location: cursos_talleres.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 39

Warning: include(Location: cursos_talleres.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 41

Warning: include() [function.include]: Failed opening 'Location: cursos_talleres.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 41

Warning: include(Location: cursos_talleres.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 43

Warning: include() [function.include]: Failed opening 'Location: cursos_talleres.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 43

Warning: include(Location: cursos_talleres.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 45

Warning: include() [function.include]: Failed opening 'Location: cursos_talleres.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 45

Warning: include(Location: cursos_talleres.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 47

Warning: include() [function.include]: Failed opening 'Location: cursos_talleres.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 47

Warning: include(Location: servicios.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 49

Warning: include() [function.include]: Failed opening 'Location: servicios.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 49

Warning: include(Location: servicios.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 51

Warning: include() [function.include]: Failed opening 'Location: servicios.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 51

Warning: include(Location: servicios.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 53

Warning: include() [function.include]: Failed opening 'Location: servicios.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 53

Warning: include(Location: servicios.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 55

Warning: include() [function.include]: Failed opening 'Location: servicios.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 55

Warning: include(Location: servicios.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 57

Warning: include() [function.include]: Failed opening 'Location: servicios.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 57

Warning: include(Location: servicios.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 59

Warning: include() [function.include]: Failed opening 'Location: servicios.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 59

Warning: include(Location: servicios.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 61

Warning: include() [function.include]: Failed opening 'Location: servicios.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 61

Warning: include(Location: clientes.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 63

Warning: include() [function.include]: Failed opening 'Location: clientes.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 63

Warning: include(Location: contacto.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 65

Warning: include() [function.include]: Failed opening 'Location: contacto.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 65

Warning: include(Location: faqs.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 67

Warning: include() [function.include]: Failed opening 'Location: faqs.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 67

Warning: include(Location: faqs.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 69

Warning: include() [function.include]: Failed opening 'Location: faqs.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 69

Warning: include(Location: registro.php) [function.include]: failed to open stream: No such file or directory in /backup/robpdc/public_html/busk.php on line 71

Warning: include() [function.include]: Failed opening 'Location: registro.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /backup/robpdc/public_html/busk.php on line 71

Por kanzer

11 de clabLevel



 

firefox
Citar            
MensajeEscrito el 22 Abr 2011 12:35 am
bueno no saia si editar mis temas de arriba o que onda
y perdon por no investigar primero, hice esto

Código PHP :

<?php

$palabra = $_POST['palabra'];

switch($palabra){

case 'Absolutos de la Calidad' :
include('quienes_somos.php');
break;

case 'Catorce Pasos de Crosby' :
include('quienes_somos.php');
break;
case 'Hoja de Modelo de Procesos' :include('quienes_somos.php');
break;
case 'Colegio de la Calidad' :include('quienes_somos.php');
break;
case 'Alexander Gage' :include('quienes_somos.php');
break;
case 'Javier Cruz Campos' :include('quienes_somos.php');
break;
case 'Roberto Rodríguez' :include('quienes_somos.php');
break;
case 'Director General' :include('quienes_somos.php');
break;
case 'Consultor Senior' :include('quienes_somos.php');
break;
case 'Alexandro Gage' :include('quienes_somos.php');
break;
case 'Director de Proyectos' :include('quienes_somos.php');
break;
case 'Cursos y Talleres' :include('cursos_talleres.php');
break;
case 'Medición' :include('cursos_talleres.php');
break;
case 'Costo de la Calidad' :include('cursos_talleres.php');
break;
case 'Diagnóstico del costo de la Calidad' :include('cursos_talleres.php');
break;
case 'Auditorias ISO 9000' :include('cursos_talleres.php');
break;
case 'Auditorias Operativas' :include('cursos_talleres.php');
break;
case 'Modelos' :include('cursos_talleres.php');
break;
case 'Proveedores' :include('cursos_talleres.php');
break;
case 'Control Estadístico de Procesos' :include('cursos_talleres.php');
break;
case 'Herramientas' :include('cursos_talleres.php');
break;
case 'Servicios' :include('servicios.php');
break;
case 'Diagnóstico' :include('servicios.php');
break;
case 'Educación' :include('servicios.php');
break;
case 'Implantación' :include('servicios.php');
break;
case 'Servicios Especiales' :include('servicios.php');
break;
case 'Gestión de la Calidad' :include('servicios.php');
break;
case 'Gestión de la Rentabilidad' :include('servicios.php');
break;
case 'Clientes' :include('clientes.php');
break;
case 'Contacto' :include('contacto.php');
break;
case 'Preguntas' :include('faqs.php');
break;
case 'FaQs' :include('faqs.php');
break;
case 'Registro' :include('registro.php');
default:
      include('index.php');
}

?>

gracias por todo

Por kanzer

11 de clabLevel



 

firefox
Citar            
MensajeEscrito el 22 Abr 2011 03:19 am
de nada, para eso estamos (a)

Por sebifrost

61 de clabLevel



 

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.