It looks OK as far as syntax. If you're not getting the desired result, then probably $_POST['action'] is not being set the way you think it should be, or there is a spelling mismatch (for instance, if the form element is named "Action" instead of "action"). You might want to debug by adding the following lines somewhere to see what values were actually passed to the script:
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation