Well, the other thing you should consider is if NULL is really what you want to be comparing your variable to. NULL and "blank" are not the same thing.
It looks like you variable may be the result of, perhapse, a form field. If that is the case, then you should compare it to "" (blank) or, better yet, "empty"; not NULL:
if (empty($firstname)") {
-- Rich Rijnders
-- Irvine, CA US