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!


In reply to Re: Easy way to run tests on many CGI params? by wardk
in thread Easy way to run tests on many CGI params? by meonkeys

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.