in reply to Easy way to run tests on many CGI params?
Although it's more code, I would suggest treating all the fields individually. Especially if you desire to have some fields be guaranteed numeric or some other format that might be required of a database. In this case you are using a CSV file, but I notice that one field is 'date_requested". It might be desireable to ensure that this date is not only a real date, but formatted in a particular way, so you have consistency.
In the case where a field is not validated, rather than report that error and continuing after the user resubmits that correction, I would suggest checking all fields and on every error, push an error message into a simple array. Then you can report all the errors to the end user looping through the error array and allow then to fix all potential problems with the form in one pass.
good luck!
|
|---|