Very simple but confusing PHP problem
Posted: Tue Apr 14, 2009 7:27 am
I've been coding simple PHP web apps for years and i've come across a really confusing error.
I'm trying to redirect back to a form if they haven't provided the acceptable amount of characters.
So my question is.... Why does this code work:
... and yet this doesn't:
$maxCvObective = 500
$minCvObective = 50
The top code redirects but the bottom does not!!! Have I missed something really obvious?
Thanks in advance.
I'm trying to redirect back to a form if they haven't provided the acceptable amount of characters.
So my question is.... Why does this code work:
Code: Select all
if(strlen($cvObjective) < $minCvObective){
$charAmount = strlen($cvObjective);
header("Location: buildCV.php?error=2&charAmount=$charAmount&cvObjective=$cvObjective");
break;
}Code: Select all
if(strlen($cvObjective) > $maxCvObective){
$charAmount = strlen($cvObjective);
header("Location: buildCV.php?error=3&charAmount=$charAmount&cvObjective=$cvObjective");
break;
}$minCvObective = 50
The top code redirects but the bottom does not!!! Have I missed something really obvious?
Thanks in advance.