This is probably obvious and you put them in just to show where you got them from. But the variables need to be before the if statement hehe . I'm sure that isn't the problem though.

Try doing
PHP Code:
on the variables to see what it comes out with. Make sure all the variables are correct.