It depends on what you want your script to do. For example, by looping through each field, the current code allows you to check that all three fields are filled out without actually having to write that code three times. If you're going to check each field individually anyway, then you might get rid of the loop. On the other hand, if you don't want to check anything special (you just want special error messages), then you might as well leave the code inside the loop and just have a list of pre-defined messages for each field.
So, what do you want to do? Start by listing each field on your form, and then deciding what errors you want to check for, and what messages to use in each case. Then, we can look at how best to organize them.
Bookmarks