Hola, tengo el siguiente problema y no tengo idea porqué sucede tengo un condicional muy simple, si la variable NO es igual a "subtitulo" entonces que de la salida para imprimir la pregunta (lo cual funciona muy bien) y si ES IGUAL a subtitulo entonces lo imprima como un encabezado de nivel 3, el problema es que si la condición es verdadera todo va muy bien, pero si la condición es falsa, no ejecuta ni lo uno ni lo otro, si fuera un error en la condición, o siempre me daría verdadero o siempre falso, a continuación pongo el código problemático:
Código PHP:
<?php if($preguntas["opcion1"] != "subtitulo"){
if($preguntas['correcta'] == $preguntas['respuesta']){
$correcta = 1;
} else {
$correcta = 0;
}
?>
<div id="preg_ind">
<div class="preg_cont"><?php echo $preguntas['preg_preg']; ?></div>
<div class="option<?php if($preguntas['respuesta'] == 1) {
if($preguntas['correcta'] == 1) { $preg1 = true; ?> correcta<?php } else { ?> incorrecta<?php } } ?>"><input type="radio" name="<?php if($correcta == 1){ } else {?>pregunta<?php echo $preguntas['id_preg']; } ?>" value="1"<?php if($preguntas['respuesta'] == 1){ ?> checked<?php } if($correcta == 1){ ?> disabled<?php } ?>> <?php echo $preguntas["opcion1"]; ?></div>
<div class="option<?php if($preguntas['respuesta'] == 2) {
if($preguntas['correcta'] == 2) { $preg2 = true; ?> correcta<?php } else { ?> incorrecta<?php } } ?>"><input type="radio" name="<?php if($correcta == 1){ } else {?>pregunta<?php echo $preguntas['id_preg']; } ?>" value="2"<?php if($preguntas['respuesta'] == 2){ ?> checked<?php } if($correcta == 1){ ?> disabled<?php } ?>> <?php echo $preguntas["opcion2"]; ?></div>
<div class="option<?php if($preguntas['respuesta'] == 3) {
if($preguntas['correcta'] == 3) { $preg3 = true; ?> correcta<?php } else { ?> incorrecta<?php } } ?>"><input type="radio" name="<?php if($correcta == 1){ } else {?>pregunta<?php echo $preguntas['id_preg']; } ?>" value="3"<?php if($preguntas['respuesta'] == 3){ ?> checked<?php } if($correcta == 1){ ?> disabled<?php } ?>> <?php echo $preguntas["opcion3"]; ?></div>
<div class="option<?php if($preguntas['respuesta'] == 4) {
if($preguntas['correcta'] == 4) { $preg4 = true; ?> correcta<?php } else { ?> incorrecta<?php } } ?>"><input type="radio" name="<?php if($correcta == 1){ } else {?>pregunta<?php echo $preguntas['id_preg']; } ?>" value="4"<?php if($preguntas['respuesta'] == 4){ ?> checked<?php } if($correcta == 1){ ?> disabled<?php } ?>> <?php echo $preguntas["opcion4"]; ?></div>
<?php if($correcta == 1){ ?><input type="hidden" name="pregunta<?php echo $preguntas['id_preg']; ?>" value="<?php echo $preguntas['respuesta']; ?>" /><?php } else { } ?>
</div>
<?php
++$num;
} else { ?>
<h3 class="sub_estudio"><?php echo $preguntas['preg_preg']; ?></h3>
<?php
} ?>
Ni siquiera me imprime el h3 no arroja absolutamente nada cuando la condición es falsa. y no tengo idea que podrá ser.