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.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |