Reformatting the code slightly:
if(strlen($name) < 4)
echo $errorname = 'Username to short';
if(strlen($name) > 14)
echo $errorname = 'Username to long';
else
header('location: congrats.php');
So, what happens if $name is too short? The first test
(strlen($name) < 4)[/code]succeeds, so the "if true" branch is taken
echo $errorname = 'Username to short';
And processing continues. Next comes another if statement and another test:
(strlen($name) > 14)
This is obviously going to fail (the length can hardly be less than four and greater than fourteen at the same time!) so the "else" branch is taken:
header('location: congrats.php');
You'd be better served writing it as
if(strlen($name) < 4)
echo $errorname = 'Username to short';
elseif(strlen($name) > 14)
echo $errorname = 'Username to long';
else
header('location: congrats.php');
Another thing:
$name = isset($_POST['name']);
From this point on, $name is either true or false - it's not a string any more, and trying to treat it as such (in, for example, strlen($name)), won't give you the results you're wanting.