Please be a lot more descriptive. Instead of giving us all the code for the page, give us the specific code that you're having trouble with, explain exactly what you expect, and what you're getting. Tell us what you've attempted to do to fix the issue.
You should use switch(case). This may not be the reason you're getting whatever error you're getting (since you still haven't told us...), but it sure does make everything a lot more organized a manipulable. Take a look at this rough draft that I wrote for you...