So you're saying the /echo got in the way?
Yes, that's what he's saying. Unless the echo is IN the IF's {}'s, it will prevent the ELSEIF or ELSE from working.
Valid:
if (this) { do this }
elseif (this) { do that }
Invalid:
if (this) { do this }
echo -a something
elseif (this) { do that }
Note that anything placed where that echo line is will prevent the ELSEIF from working.