I pull all user records from an SQL database to produce the following form. This form displays radio buttons to choose a new account status and lists the current account status and the user's name. My desire is to then process the new status settings after the form is submitted and write these changes to the database. The problem I'm encountering is that, because these radio buttons are dynamically created, I can not figure out how to pull them through cgi.pm for use in the next step.

Here is an example of the form:

A( )  N( )  Y( ) --- N John Doe 
A( )  N( )  Y( ) --- Y Jane Smith


The code that generates the form is as follows.
(I should and will eventually use cgi.pm to produce the radio buttons).

foreach my $user_record (@$user_records) { my ($username, $status) = @$user_record; print qq~ <input type="radio" name="$username" value="set_admin">A <input type="radio" name="$username" value="set_not_activated">N <input type="radio" name="$username" value="set_activated">Y --- [$status] $username<br> ~; }

The problem is that after the form is submitted, I need to be able to grab the data for each user from the form and the status for each of those users and then write those changes to the database. Obviously, the number of records will vary each time and the name element of each radio button will be different (actually, there will be three for each user since there will have to be three radio buttons for each user).

I haven't found any other examples of this, but I'm still looking. It seems like the solution is at the tip of my tongue, but I'm not quite there.


In reply to Need to retrieve data passed from dynamically created radio buttons. by Seumas

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.