Greetings, Fellow Monks.

For a recent project, users are encouraged to fill in a form with a varying number of fields - all of the fields have the same basic premise(being an answer to a question), but need to have some sort of way for me to retrieve all of them using CGI.pm. Users are able to dynamically add fields(which would also mean dynamically naming them), up to a possible limit of infinity or so. I know that I could name the fields 'answer<foo>', where <foo> is a number from 1..infinity and then just retrieve all of them, but I'm wondering: is there a better way that I can organize and retrieve these values? In my mind I'm thinking of an array of some sorts, but I'm not sure if that's actually possible.



Thanks,
Spidy


Edited Addendum: I am absolutely not going to use Javascript or Ajax to do this, as this feature is being developed for users that do not have Javascript disabled. Also, a PHP version of what I'm talking about can be seen here, if you look under "Creating a PHP array in an HTML form".

In reply to Organizing Form Input by Spidy

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.