Skip to content
Advertisement

PHP Redirect Not Working When In A Nested IF Statement

I’ve looked at several of the “PHP redirect not working ……” posts, but I haven’t had any luck figuring out what is going on with my problem.

The code below always goes to teacherActivity_2.php even though the 2nd if passes and should redirect to teacherActivity_3_shadowT.php. If I comment out the teacherActivity_2.php, the page redirects (as expected) to teacherActivity_3_shadowT.php. I think I’m missing some obscure rule that I should know but don’t. Any ideas?

Why does this redirect to teacherActivity_2.php instead of teacherActivity_3_shadowT.php?

JavaScript

Advertisement

Answer

Try the following:

JavaScript

This worked no matter how many elseifs I used.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement