You made a mistake in writing the start of the foreach loop, just swap the names and that should fix it.
$form_elements = array("username", "password", "zipcode");
foreach ($form_elements as $element) {
if (isempty($_POST[$element])) {
//...
}
}
but i didn't get why u used this.. ??
unreal128 wants to test those incoming variables in particular. This may be more useful than your version, since your version tests all incoming variables from POST, but may not test required incoming variables that are not actually sent.