Well, isalnum won't work with a space, I don't think. Personally, I'd just let all codes go through and then check the reply from the site for any errors and then display an error if there isn't a match. You'll want to do that anyhow because even if someone were to use a 5 digit number for a zip code, it wouldn't necessarily be a valid zip code.

Feel free to check out my weather script (it's 2 parts right now - server and user because I never did make a combined version). It might give you some ideas.